BigInteger.ToString Method (IFormatProvider)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Converts the numeric value of the current BigInteger object to its equivalent string representation by using the specified culture-specific formatting information.
Namespace: System.Numerics
Assembly: System.Numerics (in System.Numerics.dll)
Syntax
'Declaration
Public Function ToString ( _
provider As IFormatProvider _
) As String
public string ToString(
IFormatProvider provider
)
Parameters
- provider
Type: System.IFormatProvider
An object that supplies culture-specific formatting information.
Return Value
Type: System.String
The string representation of the current BigInteger value in the format specified by the provider parameter.
Remarks
The returned string is formatted with the general format specifier ("G").
The ToString(IFormatProvider) method supports 50 decimal digits of precision. That is, if the BigInteger value has more than 50 digits, only the 50 most significant digits are preserved in the output string; all other digits are replaced with zeros.
The provider parameter is an IFormatProvider implementation. Its GetFormat method returns a NumberFormatInfo object that provides culture-specific information about the format of the string returned by this method. If provider is nulla null reference (Nothing in Visual Basic), the BigInteger value is formatted using the NumberFormatInfo object of the current culture. The only property of the NumberFormatInfo object that controls the string representation of the BigInteger value using the general format specifier is NumberFormatInfo.NegativeSign, which defines the character that represents the negative sign.
The provider parameter can be one of the following:
A CultureInfo object that represents the culture that supplies formatting information.
The NumberFormatInfo object that supplies formatting information.
A custom object that implements IFormatProvider. Its GetFormat method returns the NumberFormatInfo object that supplies formatting information.
Examples
The following example instantiates a custom NumberFormatInfo object that defines the tilde (~) as a negative sign. The ToString(IFormatProvider) method then uses the custom NumberFormatInfo object to display a negative BigInteger value.
Version Information
Silverlight
Supported in: 5, 4
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.