C# BigInteger BigInteger(Decimal)

Description

BigInteger BigInteger(Decimal) Initializes a new instance of the BigInteger structure using a Decimal value.

Syntax

BigInteger.BigInteger(Decimal) has the following syntax.


public BigInteger(
  decimal value
)

Parameters

BigInteger.BigInteger(Decimal) has the following parameters.

  • value - A decimal number.

Example

The following example illustrates the use of the BigInteger(Decimal) constructor to instantiate a BigInteger object.


using System;//from w ww. j  a  v a  2 s  .  c om
using System.Numerics;

public class Example
{
   public static void Main()
   {
        decimal[] decimalValues = { -1790.533m, -15.1514m, 18903.79m, 9180098.003m };
        foreach (decimal decimalValue in decimalValues)
        {
           BigInteger number = new BigInteger(decimalValue);
           Console.WriteLine("Instantiated BigInteger value {0} from the Decimal value {1}.",
                             number, decimalValue);
        }                 

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex