【问题标题】:The type or namespace name 'Vector<double>' does not exist in the namespace 'System.Numerics'命名空间“System.Numerics”中不存在类型或命名空间名称“Vector<double>”
【发布时间】:2016-02-10 11:54:07
【问题描述】:

我尝试在我的代码中使用System.Numerics.Vector&lt;double&gt;(),但出现构建错误

命名空间“System.Numerics”中不存在类型或命名空间名称“Vector”

我是否缺少程序集引用?

我的 csproj 面向 .NET 4.6.1

<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />

其他类型显示正确

【问题讨论】:

标签: .net system.numerics


【解决方案1】:

例如,当您查看 ToString 方法时,MSDN 会在顶部显示 .NET 版本。但是对于Vector,奇怪的是,它没有。它可能已从 .NET 框架移至 Nuget 存储库,MS 保留了 MSDN 文档,但没有说明任何内容。

无论如何,如果您确定您使用的是4.6.1 runtime(它不适用于4.5.1 和4.5.2),只需安装this nuget package,它就可以正常工作。

【讨论】:

  • 可能是因为这些类型存在于框架本身中,而不是附加组件Numerics.Vectors 包中。我同意 MSDN 可以更清楚地说明这一事实。
猜你喜欢
  • 1970-01-01
  • 2012-06-19
  • 1970-01-01
  • 2012-05-28
  • 1970-01-01
  • 1970-01-01
  • 2018-05-09
  • 2022-01-11
  • 2021-10-15
相关资源
最近更新 更多