hope you are both doing well :-)
If I need to terminate or stop processing one of some or all functions, what is the best way to do that.
Saying:
this.Close(); Or
Application.Exist(); Or
System.Environment.Exist (int exitCode); // I don't know how to know the ExitCode to pass it to the OS! Or
Maybe none of the above!? Do I need some other codes/functions to check the status of the method that I need to terminate?
What if I need to cancel running the function that reads and rename multiple files.
In that case, if I press on cancel, what will happen to my processed files? will be deleted ?or what have been processed are done and I can find them "Processed already?
Abhishek JainPosted Aug 28, 2013, 10:03 AM
Application.Exit - It basically asks all the thread to terminate, and once all the threads terminates it automatically closes down all the Windows of the application.
Environment.Exit - It basically terminates the whole process, so there is difference, a process can have multiple threads.
Now if you want to Exit from a particular Thread, use
Application.ExitThread - It terminates a particular thread.
So as you asked a function "reads and rename multiple files", i think the for all the files for which the processing has been done, will be renamed and for all which are left will be left in the same condition, and if the thread is in middle of the operation of renaming, then that fill will not be renamed, and will be left as is...