【问题标题】:System.Threading.Timer don't want to import to projectSystem.Threading.Timer 不想导入到项目中
【发布时间】:2017-11-30 20:31:23
【问题描述】:

我尝试从 System.Threading.Timer 定义对象,但我的 Visual Studio 2017(社区)不想将此库导入我的项目,如果我已安装包并手动放置 using System.Threading.Timer。有谁可以帮忙?

请看下面的屏幕截图

【问题讨论】:

  • 如果您可以发布参考文献和使用语句,请这样做。不鼓励链接到图片
  • 您需要将 using 添加到 .cs 文件类头中。如果需要,请手动将其添加到引用节点
  • 你需要using System.Threading;
  • 正如@JimMischel 所说,使用 System.Threading;应该使用。看msdn上的例子msdn.microsoft.com/en-us/library/…
  • 不幸的是它没有帮助,即使我只使用 using System.Threading 它也会崩溃 Task 命名空间。现在我有两种错误: - The type or namespace name 'Timer' could not be found - The type or namespace name 'Task<>' could not be found IMO 参考文献有问题

标签: c# visual-studio xamarin.forms mobile-application


【解决方案1】:

无需创建对特定库的引用。只需添加

using System.Threading;

在文件的顶部。创建一个像文档中定义的计时器。 https://docs.microsoft.com/en-us/dotnet/api/system.threading.timer?view=netframework-4.7.1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多