C# System.Threading.Task 不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19783983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 15:52:36  来源:igfitidea点击:

System.Threading.Task Is not working

c#asp.net

提问by code save

System.Threading.Tasks is not Working in my project. I has been trying to use All DLL regarded This error
I Search various Code But Did not Get Any Solution

System.Threading.Tasks 在我的项目中不起作用。我一直在尝试使用所有的DLL都认为这个错误
我搜索了各种代码但没有得到任何解决方案

I am Using Asp.net 2008 (3.5)

我正在使用 Asp.net 2008 (3.5)

Error show here -

错误显示在这里 -

The type or namespace name 'Tasks' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?)

命名空间“System.Threading”中不存在类型或命名空间名称“Tasks”(您是否缺少程序集引用?)

so help me thanks

所以帮我谢谢

回答by Soner G?nül

I think you missing typing.

我想你错过了打字。

The right class name is Tasknot Tasksand it belongs on System.Threading.Tasksnamespace.

正确的类名Task不是Tasks,它属于System.Threading.Tasks命名空间。

回答by Irvin Dominin

This library is not available in .NET 3.5, make sure that you are targeting .NET 4.0 in your project properties.

此库在 .NET 3.5 中不可用,请确保您在项目属性中面向 .NET 4.0。

Ref: http://msdn.microsoft.com/library/system.threading.tasks.aspx

参考:http: //msdn.microsoft.com/library/system.threading.tasks.aspx

回答by ravy amiry

The correct class (and namespace) name is System.Threading.Tasks.Taskwhich is located in mscorlib.dlland is available in .NET 4+. If you want to use it in .NET 3.5, you can do this by using Microsoft Reactive Extensions.

正确的类(和命名空间)名称System.Threading.Tasks.Task位于+中mscorlib.dll并且在.NET 4+ 中可用。如果要在 中使用它.NET 3.5,可以使用Microsoft Reactive Extensions 来实现

回答by MaxEcho

Finding a PackageFrom the Toolsmenu, select Library Package Managerand then click Package Manager Console

查找包工具菜单中,选择库包管理器,然后单击包管理器控制台

enter image description here

在此处输入图片说明

The Package Manager Consolewindow is displayed.

显示包管理器控制台窗口。

enter image description here

在此处输入图片说明

Write Install-Package System.Threading.dllin console and press ENTER

在控制台中写入Install-Package System.Threading.dll并按 ENTER

PM> Install-Package System.Threading.dll