中 C# 中,有一个接口定义了一个异步方法,但实现接口时并没有异步操作,没有用到 await ,编译器会告警:
This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
请问如何最优雅地消除这个警告?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
既然定义了异步方法,楼主为什么不直接使用异步操作呢
return Task.CompletedTask