I am trying to learn the async and await features of .NET 4.5 .First of all here's my code
static async void Method()
{
await Task.Run(new Action(DoSomeProcess));
Console.WriteLine("All Methods have been executed");
}
static void DoSomeProcess()
{
System.Threading.Thread.Sleep(3000);
}
static void Main(string[] args)
{
Method();
//Console.WriteLine("Method Started");
Console.ReadKey();
}
This code doesn't give me any results on the console. I cant understand why. I mean aren't tasks suppose be just threads that aren't blocking. However if i uncomment the Console.WriteLine() in the main method everything seems to be working fine.
Can anybody tell me what's going on here ?