相关疑难解决方法(0)

async/await上的MSDN示例 - 在await调用之后我不能到达断点吗?

在async/await上尝试MSDN的例子时,为什么我在await运算符之后无法达到断点?

private static void Main(string[] args)
{
    AccessTheWebAsync();
}

private async Task<int> AccessTheWebAsync()
{ 
    // You need to add a reference to System.Net.Http to declare client.
    HttpClient client = new HttpClient();

    // GetStringAsync returns a Task<string>. That means that when you await the
    // task you'll get a string (urlContents).
    Task<string> getStringTask = client.GetStringAsync("http://msdn.microsoft.com");

    // You can do work here that doesn't rely on the string from GetStringAsync.
    /*** not relevant here ***/
    //DoIndependentWork();

    // The await operator suspends AccessTheWebAsync. …
Run Code Online (Sandbox Code Playgroud)

c# async-await

2
推荐指数
1
解决办法
779
查看次数

标签 统计

async-await ×1

c# ×1