C# BigInteger BigInteger(UInt32)

Description

BigInteger BigInteger(UInt32) Initializes a new instance of the BigInteger structure using an unsigned 32-bit integer value.

Syntax

BigInteger.BigInteger(UInt32) has the following syntax.


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

Parameters

BigInteger.BigInteger(UInt32) has the following parameters.

  • value - An unsigned 32-bit integer value.

Example


using System;// www  .  j  a  va  2s.  c  om
using System.Numerics;

public class Example
{
   public static void Main()
   {
        uint[] unsignedValues = { 0, 123123, 123123, UInt32.MaxValue };
        foreach (uint unsignedValue in unsignedValues)
        {
           BigInteger constructedNumber = new BigInteger(unsignedValue);
           BigInteger assignedNumber = unsignedValue;
           if (constructedNumber.Equals(assignedNumber))
              Console.WriteLine("Both methods create a BigInteger whose value is {0:N0}.",
                                constructedNumber);
           else
              Console.WriteLine("{0:N0} ` {1:N0}", constructedNumber, assignedNumber);
        
        }
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex