Mega Code Archive

 
Categories / C# Book / 02 Essential Types
 

0325 BigInteger casting

Implicitly cast a BigInteger to a standard numeric type and explicitly cast in the other direction. For instance: using System; using System.Numerics; class Sample { public static void Main() { double g1 = 1e100; // implicit cast BigInteger g2 = (BigInteger)g1; // explicit cast Console.WriteLine(g2); } } The output: 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104