C# BigInteger BigInteger(Int32)

Description

BigInteger BigInteger(Int32) Initializes a new instance of the BigInteger structure using a 32-bit signed integer value.

Syntax

BigInteger.BigInteger(Int32) has the following syntax.


public BigInteger(
  int value
)

Parameters

BigInteger.BigInteger(Int32) has the following parameters.

  • value - A 32-bit signed integer.

Example


using System;// w  w w.j  a v  a2s  .c  o  m
using System.Numerics;

public class Example
{
   public static void Main()
   {
        int[] integers = { Int32.MinValue, -123123, -189, 0, 17, 123123123,
                           Int32.MaxValue };
        BigInteger constructed, assigned;
        
        foreach (int number in integers)
        {
           constructed = new BigInteger(number);
           assigned = number;
           Console.WriteLine("{0} = {1}: {2}", constructed, assigned, 
                             constructed.Equals(assigned)); 
        }                                                  

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex