I've written a small app which downloads a file from the internet then parses it.
If the file cannot be downloaded, the execption is caught and it calls its self again for another try. (however, this will go on forever)
i'm using for example
public static void getFile()
{
string fileToGet = " ;
string fileToPut = "myFolder/afile.txt" ;
try
{
WebClient Client = new WebClient();
Client.DownloadFile(fileToGet, fileToPut);
}
catch (Exception exp) {getFile();}
}
what i would like to do is try say 5 times then if it still can't download then quit the program...
Is there a forced exit command in C# that will just quit the program and do nothing else ??
If the file cannot be downloaded, the execption is caught and it calls its self again for another try. (however, this will go on forever)
i'm using for example
public static void getFile()
{
string fileToGet = " ;
string fileToPut = "myFolder/afile.txt" ;
try
{
WebClient Client = new WebClient();
Client.DownloadFile(fileToGet, fileToPut);
}
catch (Exception exp) {getFile();}
}
what i would like to do is try say 5 times then if it still can't download then quit the program...
Is there a forced exit command in C# that will just quit the program and do nothing else ??