技术交流QQ群【JAVA,C++,Python,.NET,BigData,AI】:170933152
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();