![]() ![]() Var timeout = (Convert.ToDouble(ms)) Ĭonsole.WriteLine("Second thread is executing") Ĭonsole.WriteLine("Second thread is finished") You can use the thread to execute the delay function avoid the main thread blocking. The following method is to use a function “Wait” to block execution of the current thread during the “ms” milliseconds, Private static void OnTimedEvent(Object source, e)Ĭonsole.WriteLine("The Elapsed event was raised at ", Hook up the Elapsed event for the timer. The following code will execute “OnTimedEvent” in five seconds: private static Timer aTimer ![]() Use the “Interval” property of to set the interval. From your description, I have made a sample on my side, and I use the following methods to make a ‘delay’ using c#.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |