KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying get my hands dirty with async CTP and I noticed that the compiler complains about the async return type. What is the problem with other types? A simple demo static void Main(string[] args) { DoWork(); Console.WriteLine("Returned to main"); Console.Read(); } // why do I need to return void, Task or Task<T> here? // I know I can use something like Task<IEnumerable<string>> private static async string[] DoWork() { Console.WriteLine("DoWork started"); return await Task.Factory.StartNew( delegate { Thread.Sleep(2000); Console.WriteLine("DoWork done"); return new List<string>(); }); }
Tags (comma-separated)
Save Edits
Cancel