我是相当新手在异步世界,我试图找出如何确保我的主要的控制台应用程序,方法,实际运行的异步
I am fairly novice in the async world, and I am trying to figure out how to make sure my main method of an console app actually runs async
class Program
{
static void Main(string[] args)
{
Bootstrapper bs = new Bootstrapper();
var list = bs.GetList();
}
}
public class Bootstrapper {
public async Task<List<TvChannel>> GetList()
{
GetPrograms pro = new GetPrograms();
return await pro.DownloadTvChannels();
}
}
我知道这是不是从顶运行异步。但因为你不能标注主要用异步我不知道如何来确保。有任何想法吗 ?谢谢!
I know this is not running async from "the top". but since you cannot mark the Main with async I have no idea of how to make sure. Any ideas ? Thank you!
当你发现,在VS11编译器将不允许一个异步主
方法。这是允许的(但绝不推荐)在VS2010与异步CTP。
As you discovered, in VS11 the compiler will disallow an async Main
method. This was allowed (but never recommended) in VS2010 with the Async CTP.
我有关于异步/计谋和的