c# - 运行一个异步任务至少需要多少个线程?

标签 c# .net .net-core

这是一位高级经理提出的面试问题。

运行一个异步任务至少需要多少个线程?

我说过至少需要一个线程,但我不确定我说得对不对。

有什么想法吗?

最佳答案

来自Microsoft :

Async methods don't require multithreading because an async method doesn't run on its own thread. The method runs on the current synchronization context and uses time on the thread only when the method is active.

您给出了正确答案。

关于c# - 运行一个异步任务至少需要多少个线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73158242/

相关文章:

c# - 如何使用 MVC Html Helpers 截断字符串?

c# - Entity Framework Core 根据类的类型显式加载相关数据

c# - WPF:删除标题/控制框

c# - Visual Studio 以编程方式附加到托管进程

c# - 在 C# 中的一个操作中处理多个按钮操作

c# - UI 文本未呈现但出现在层次结构中——缺少什么?

c# - FileNotFoundException 和文件路径

c# - 阿瓦隆编辑 : Textstate

c# - .NET Core SDK 的错误 : Version 5. 0.10 0-alpha1-014696 需要至少版本 16.3.0 的 MSBuild

c# - Azure Blob 存储未上传