C# BigInteger ToString(IFormatProvider)

Description

BigInteger ToString(IFormatProvider) Converts the numeric value of the current BigInteger object to its equivalent string representation by using the specified culture-specific formatting information.

Syntax

BigInteger.ToString(IFormatProvider) has the following syntax.


public string ToString(
  IFormatProvider provider
)

Parameters

BigInteger.ToString(IFormatProvider) has the following parameters.

  • provider - An object that supplies culture-specific formatting information.

Returns

BigInteger.ToString(IFormatProvider) method returns The string representation of the current BigInteger value in the format specified by the provider parameter.

Example


using System;// w ww  . ja  v a  2 s  .com
using System.IO;
using System.Numerics;
using System.Globalization;

public class Example
{
    public static void Main()
    {
        BigInteger number = 9867857831128;
        number = BigInteger.Pow(number, 3) * BigInteger.MinusOne;

        NumberFormatInfo bigIntegerProvider = new NumberFormatInfo();
        bigIntegerProvider.NegativeSign = "~";

        Console.WriteLine(number.ToString(bigIntegerProvider));
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex