本文共 433 字,大约阅读时间需要 1 分钟。
private async void test(){
TestClient client =new TestClient();
TestOut out=await client.Execute();//这种这里包含 await也就是在方法中有调用异步方法的用法的时候.需要在方法前面加async,
//但是要注意,async,只能加在void方法或者Task<T> 前面
}
比如:
private async Task<int> test(){
TestClient client =new TestClient();
TestOut out=await client.Execute();//这种这里包含 await也就是在方法中有调用异步方法的用法的时候.需要在方法前面加async,
//但是要注意,async,只能加在void方法或者Task<T> 前面
return 1;
}
这里调用test()的时候.一样这样调用:
前面加await test();
转载地址:http://hltdf.baihongyu.com/