Where is my System.Numerics namespace?

ⅰ亾dé卋堺 提交于 2019-11-26 09:58:19

问题


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?

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.


回答1:


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

The MSDN entry on BigInteger states:

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




回答2:


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.

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.


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.



来源:https://stackoverflow.com/questions/4820953/where-is-my-system-numerics-namespace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!