如何在 MonoDevelop 的 Mono C# 中使用 System.Numerics?
How do I use System.Numerics in Mono C# in MonoDevelop?
当我的文件顶部有这一行时:
using System.Numerics;
我收到以下错误:
Error CS0234: The type or namespace name 'Numerics' does not exist in the namespace 'System' (are you missing an assembly reference?) (CS0234) (CSharpTests)
我文件顶部的其他 using
指令,例如 using System;
,工作正常。
我在 Ubuntu 18.04 64 位上使用 Mono 5.12.0.301 和 MonoDevelop 7.5(内部版本 1255)。
我的第一个想法是框架版本设置得足够旧以至于没有 System.Numerics
。在Options -> Build -> General中,我的framework版本默认是4.5,改成最新的4.7.1版本也不行:
This answer 发现问题出在框架版本过时,但显然我有足够新的框架版本,对吧?
编辑:好的,根据 SushiHangover 的回答,我可以使用 System.Numerics,但实际上我正在尝试使用 System.Numerics.Vectors,我已将其包含在参考文献中:
但是当我使用 using System.Numerics.Vectors;
时,我得到这个错误:
Error CS0234: The type or namespace name 'Vectors' does not exist in the namespace 'System.Numerics' (are you missing an assembly reference?) (CS0234) (CSharpTests)
您需要手动添加对该程序集的引用(以及框架中您需要使用的任何其他程序集,默认包含 "System")
双击解决方案资源管理器中的项目 "References":
当我的文件顶部有这一行时:
using System.Numerics;
我收到以下错误:
Error CS0234: The type or namespace name 'Numerics' does not exist in the namespace 'System' (are you missing an assembly reference?) (CS0234) (CSharpTests)
我文件顶部的其他 using
指令,例如 using System;
,工作正常。
我在 Ubuntu 18.04 64 位上使用 Mono 5.12.0.301 和 MonoDevelop 7.5(内部版本 1255)。
我的第一个想法是框架版本设置得足够旧以至于没有 System.Numerics
。在Options -> Build -> General中,我的framework版本默认是4.5,改成最新的4.7.1版本也不行:
This answer 发现问题出在框架版本过时,但显然我有足够新的框架版本,对吧?
编辑:好的,根据 SushiHangover 的回答,我可以使用 System.Numerics,但实际上我正在尝试使用 System.Numerics.Vectors,我已将其包含在参考文献中:
但是当我使用 using System.Numerics.Vectors;
时,我得到这个错误:
Error CS0234: The type or namespace name 'Vectors' does not exist in the namespace 'System.Numerics' (are you missing an assembly reference?) (CS0234) (CSharpTests)
您需要手动添加对该程序集的引用(以及框架中您需要使用的任何其他程序集,默认包含 "System")
双击解决方案资源管理器中的项目 "References":