C# BigInteger ToString()

Description

BigInteger ToString() Converts the numeric value of the current BigInteger object to its equivalent string representation.

Syntax

BigInteger.ToString() has the following syntax.


public override string ToString()

Returns

BigInteger.ToString() method returns The string representation of the current BigInteger value.

Example


using System;//w  ww .  ja  v  a2  s  .c  om
using System.IO;
using System.Numerics;

public class Example
{
   public static void Main()
   {
        BigInteger value = BigInteger.Add(UInt64.MaxValue, 1024);
        
        Console.WriteLine(value.ToString());     
        Console.WriteLine(value.ToString("G"));
        Console.WriteLine(value.ToString("C"));
        Console.WriteLine(value.ToString("D"));
        Console.WriteLine(value.ToString("F"));
        Console.WriteLine(value.ToString("N"));
        Console.WriteLine(value.ToString("X"));       
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex