c# – 在Mac上的.NET Core中的Thread.Sleep()

我在Mac机器上使用.NET Core.

在我的代码中,我想使用这段代码

System.Threading.Thread.Sleep(100);

但是在System.Threading命名空间中找不到Thread.

怎么了?不是线程可用于Mac,还是我缺少的东西?

解决方法

Isn’t Thread available for Mac?

还没有:https://github.com/dotnet/corefx/issues/2576

The current System.Threading.Thread (and System.Threading.ThreadPool) packages only support desktop and CoreCLR.

和:https://github.com/dotnet/corefx/issues/2576#issuecomment-187184341

I can see that the latest System.Threading.Thread package in the dotnet-core NuGet Feed hasn’t changed this picture.

相关文章

本文将从上往下,循序渐进的介绍一系列相关.NET的概念,先从...
基于 .NET 的一个全新的、好用的 PHP SDK + Runtime: Pe...
.NET 异步工作原理介绍。
引子 .NET 6 开始初步引入 PGO。PGO 即 Profile Guided Opti...
前言 2021/4/8 .NET 6 Preview 3 发布,这个版本的改进大多来...
前言 开头防杠:.NET 的基础库、语言、运行时团队从来都是相...