Create BigInteger from a Decimal value in CSharp

Description

The following code shows how to create BigInteger from a Decimal value.

Example


/*w  w  w . ja v a2s.c  o  m*/
using System;
using System.Numerics;

public class Example
{
    public static void Main()
    {
        decimal[] decimalValues = { -1.5m, -1.1m, 1.7m, 9.3m };
        foreach (decimal decimalValue in decimalValues)
        {
            BigInteger number = new BigInteger(decimalValue);
            Console.WriteLine(number);
        }
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var