I want add a timer in the C# method. When this method execute more than 500 second. the method will throw exception. like this:
if(sw.ElapsedMilliseconds > timeout)
{
break;
}
Do you have any good idea better than StopWatch ? Except Thread. :)
Thank you very much!
You can use Task with CancellationTokenSource