Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void DoWork()
- {
- Console.WriteLine("Work Starting");
- Thread.Sleep(2000);
- Console.WriteLine("Work Finished");
- }
- public static void Run()
- {
- //Creates ans starts the task
- Task newTask = Task.Run(() => DoWork());
- newTask.Wait();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement