如何在VS 2010中使用BigInteger

7

我一直在尝试使用BigInteger类型,这是.NET Framework 4.0中新推出的。

但是我好像无法使用它,在尝试通过Using System.Numerics引用它时出现错误。

请问我做错了什么?如果这是一个愚蠢的问题,请原谅...


你能提供一段代码示例吗? - Evan Mulawski
4个回答

14
  1. Add a reference to the System.Numerics assembly to your project.

    a. In Solution Explorer, right-click the project node and click Add Reference.

    b. In the Add Reference dialog box, select the .NET tab.

    c. Select System.Numerics, and then click OK.

  2. Add a using directive importing the System.Numerics namespace:

    using System.Numerics;
    
  3. Use the BigInteger structure:

    var i = new BigInteger(934157136952);
    

@Bradley:没有任何区别。 - Brian R. Bondy

3

你是否已经添加了对System.Numerics的引用?

右键点击“引用” -> 添加引用 -> .NET选项卡 -> System.Numerics -> 确定


1

添加对 System.Numerics 程序集的引用。

添加 using System.Numerics; 语句。


1
你是否已经添加了一个项目引用(项目...添加引用...)到System.Numerics?

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接