Convert BigInteger to string using the specified format in CSharp

Description

The following code shows how to convert BigInteger to string using the specified format.

Example


  /*from w ww  . ja  v  a2  s .  c  o  m*/
  
  
  
using System;
using System.Numerics;
using System.Globalization;
public class Example
{
   public static void Main()
   {
        BigInteger value = BigInteger.Parse("-903145792771643190182");
        string[] specifiers = { "C", "D", "D25", "E", "E4", "e8", "F0", 
                                "G", "N0", "P", "R", "X", "0,0.000", 
                                "#,#.00#;(#,#.00#)" };
        
        foreach (string specifier in specifiers)
           Console.WriteLine("{0}: {1}", specifier, value.ToString(specifier));
   }
}

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