Retry the File for three times If the File Exists through Recursive Method in C#
My Requirement is I Want My File to be Retried for 3 times If the Particular File Exists , I Have Achieved But the thing is I Want the Working Copy through Recursive Method which returns Boolean , Below Is my Working Code Which is not returned Boolean :
public void Process(int count = 0)
bool exists = File.Exists("C:\\Users\\sk185462\\Desktop\\SVNUPDATED\\RevisionNumber.txt");
if (exists && count < 3)
Thread.Sleep(2000); // or long enough to ensure the uninstall process finishes executing
Console.WriteLine("Exceeded retry of 3 times. File did not uninstall.");
Could Any One Help Me Out by Providing the solution through recursive method which returns boolean , and retry the file for three times if the file exists if not exists then execute only once.