C# 实践 1 await 关键字
参考: https://docs.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/await
代码:
//----------------------------------------------- // Connect to devices data stream if (!await dataStream.ConnectAsync()) { return false; // connection failed }
await 修饰的被调用函数,主线程会等待它先执行结束,然后继续执行。会挂起