Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- namespace test1
- {
- public class Program
- {
- private static async void SampleAsync()
- {
- Console.WriteLine("SampleAsync start\n");
- await Task.Run((Action) LongProccess);
- Console.WriteLine("SampleAsync end\n");
- }
- private static void LongProccess()
- {
- Console.WriteLine("LongProc start\n");
- Thread.Sleep(TimeSpan.FromSeconds(10));
- Console.WriteLine("LongProc end\n");
- }
- private static void Main()
- {
- Console.WriteLine("Main start\n");
- SampleAsync();
- Console.WriteLine("Main end\n");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment