meh*_*dvd 9 c# macos .net-core .net-mac
我在Mac机器上使用.NET Core.
我的代码中的某个地方我想使用这段代码:
System.Threading.Thread.Sleep(100);
Run Code Online (Sandbox Code Playgroud)
但它无法Thread在System.Threading命名空间中找到.
怎么了?不适Thread用于Mac,或者我遗失了什么?
Ant*_*kov 12
你有System.Threading.Thread包添加到你的project.json?
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23811",
"System.Threading.Thread": "4.0.0-beta-23516"
},
"frameworks": {
"dnxcore50": { }
}
}
Run Code Online (Sandbox Code Playgroud)
然后我可以使用Thread.Sleep:
using System;
using System.Threading;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine(DateTime.Now);
Thread.Sleep(2000);
Console.WriteLine("Hello World!");
Console.WriteLine(DateTime.Now);
}
}
}
Run Code Online (Sandbox Code Playgroud)
不适
Thread用于Mac?
还没有:https://github.com/dotnet/corefx/issues/2576
当前的System.Threading.Thread(和System.Threading.ThreadPool)包仅支持桌面和CoreCLR.
并且:https://github.com/dotnet/corefx/issues/2576#issuecomment-187184341
我可以看到dotnet-core NuGet feed中最新的System.Threading.Thread包没有改变这张图片.
| 归档时间: |
|
| 查看次数: |
4620 次 |
| 最近记录: |