i`v been studing about async progrmaming in .net today and what i understood is that this code Should NOT create a new thread but i see different ThreadId with calling Thread.CurrentThread.ManagedThreadId.
static void Main(string[] args)
{
Do();
Console.WriteLine("Main {0}",Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(400);
}
private static async void Do()
{
Task<string> task = new StreamReader(@"D:\a.txt").ReadLineAsync();
string result = await task;
Console.WriteLine("DO {0}", Thread.CurrentThread.ManagedThreadId);
}
thanks everyone for reading this..
asyncintro on my blog that you may find helpful; I tried to make it an intro that covers everything you need to know in a single post, with detailed followup links at the bottom.