await用法
private static async void Test()
{
Task<string> t = new Task<string>(() => { System.Threading.Thread.Sleep(3000); return "1 " System.Threading.Thread.CurrentThread.ManagedThreadId; });
t.Start();
string tr = await t;
Console.WriteLine(tr);
}
评论