我的System.Numerics命名空间在哪里?

时间:2021-07-20 16:51:31

I'm using Visual Studio 2010 and trying to use the BigInteger type in a C# program. This type is supposed to be available in System.Numerics namespace, but I don't seem to have that installed in the .Net 4.0 framework. When I type "using System.Numerics;" in VS2010, a red underline appears under the "Numerics". Has anyone else ever had this problem?

我正在使用Visual Studio 2010并尝试在C#程序中使用BigInteger类型。这种类型应该在System.Numerics命名空间中可用,但我似乎没有在.Net 4.0框架中安装它。当我输入“using System.Numerics;”时在VS2010中,“Numerics”下面出现红色下划线。还有其他人有过这个问题吗?

If so, how do you resolve it? I just re-downloaded and re-installed (repaired) the .Net 4.0 framework, but that didn't help. I've never had any problems with other C# programs that I've written, so I'm wondering what I'm missing.

如果是这样,你如何解决它?我刚刚重新下载并重新安装(修复).Net 4.0框架,但这没有帮助。我从来没有遇到过我写过的其他C#程序的任何问题,所以我想知道我错过了什么。

2 个解决方案

#1


43  

You need to add an assembly reference to System.Numerics.dll

您需要向System.Numerics.dll添加程序集引用

The MSDN entry on BigInteger states:

BigInteger上的MSDN条目指出:

BigInteger Structure
...
Namespace: System.Numerics
Assembly: System.Numerics (in System.Numerics.dll)

BigInteger Structure ...命名空间:System.Numerics程序集:System.Numerics(在System.Numerics.dll中)

#2


1  

Though most assemblies are the part of the installation, VS does add only some core elements to the reference list of a project (Core, Data, XML etc.). One needs to add other references by hand using Reference Manager.

虽然大多数程序集都是安装的一部分,但VS确实只将一些核心元素添加到项目的参考列表(核心,数据,XML等)。需要使用Reference Manager手动添加其他引用。

Right-click your project, then select Add Reference (or Add->Reference). System.Numerics resides in Assemblies. Then you can use using System.Numerics; in project files.

右键单击项目,然后选择“添加引用”(或“添加” - >“引用”)。 System.Numerics驻留在Assemblies中。然后你可以使用System.Numerics;在项目文件中。


PS: this answer is not intended to get any vote. It is only for future reference if someone needs how to do it, just as I needed before this answer.

PS:这个答案不是为了得到任何投票。如果有人需要怎么做,它只是为了将来参考,正如我在这个答案之前所需要的那样。

#1


43  

You need to add an assembly reference to System.Numerics.dll

您需要向System.Numerics.dll添加程序集引用

The MSDN entry on BigInteger states:

BigInteger上的MSDN条目指出:

BigInteger Structure
...
Namespace: System.Numerics
Assembly: System.Numerics (in System.Numerics.dll)

BigInteger Structure ...命名空间:System.Numerics程序集:System.Numerics(在System.Numerics.dll中)

#2


1  

Though most assemblies are the part of the installation, VS does add only some core elements to the reference list of a project (Core, Data, XML etc.). One needs to add other references by hand using Reference Manager.

虽然大多数程序集都是安装的一部分,但VS确实只将一些核心元素添加到项目的参考列表(核心,数据,XML等)。需要使用Reference Manager手动添加其他引用。

Right-click your project, then select Add Reference (or Add->Reference). System.Numerics resides in Assemblies. Then you can use using System.Numerics; in project files.

右键单击项目,然后选择“添加引用”(或“添加” - >“引用”)。 System.Numerics驻留在Assemblies中。然后你可以使用System.Numerics;在项目文件中。


PS: this answer is not intended to get any vote. It is only for future reference if someone needs how to do it, just as I needed before this answer.

PS:这个答案不是为了得到任何投票。如果有人需要怎么做,它只是为了将来参考,正如我在这个答案之前所需要的那样。