BigInteger Constructor (UInt64)

Initializes a new instance of the BigInteger structure with an unsigned 64-bit integer value.

This API is not CLS-compliant. The CLS-compliant alternative is BigInteger(Double).

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

[CLSCompliantAttribute(false)]
public BigInteger(
	ulong value
)

Parameters

value
Type: System.UInt64
An unsigned 64-bit integer.

There is no loss of precision when instantiating a BigInteger using this constructor.

The BigInteger value that results from calling this constructor is identical to the value that results from assigning a UInt64 value to a BigInteger.

The following example uses the BigInteger(UInt64) constructor to instantiate a BigInteger object whose value is equal to MaxValue.


ulong unsignedValue = UInt64.MaxValue;
BigInteger number = new BigInteger(unsignedValue);
Console.WriteLine(number.ToString("N0"));       
// The example displays the following output:
//       18,446,744,073,709,551,615      


.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft