IntroductionThe purpose this structure is an arbitrary-precision integer data type that supports all the standard integer operations, including bit manipulation. It can be used from any .NET Framework language. In addition, some of the new .NET Framework languages (such as F# and IronPython) have built-in support for this structure. How to useDeclarationBigInteger objbigInt = new BigInteger(179032.6541);
Another way of declaration, create a long variable and then assign directly that variable to bigInteger object like followings. long longValue = 6315489358112;
BigInteger assignedFromLong = longValue;
And this is also support all type of basic casting and convert as hexa. Complete Sampleusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string positiveNoString = "91389681247993671255432112000000";
string negativeNoString = "-90315837410896312071002088037140000";
BigInteger posBigInt = 0;
BigInteger negBigInt = 0;
try
{
posBigInt = BigInteger.Parse(positiveNoString);
Console.WriteLine(posBigInt);
}
catch (FormatException)
{
Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.",
positiveNoString);
}
if (BigInteger.TryParse(negativeNoString, out negBigInt))
Console.WriteLine(negBigInt);
else
Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.",
negativeNoString);
}
}
}
What are the methods and propertie has this structure.here is snap shot of the System.Numerics.BigInteger Here is more information .enjoy the new .NET Framework 4.0 features. |