Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
- provider
An IFormatProvider that supplies culture-specific formatting information.
![]()
The string representation of the value of this instance as specified by provider.
The long.ToString(IFormatProvider) method formats an long value in the default ("G", or general) format by using the System.Globalization.NumberFormatInfo object of a specified culture. If you want to specify a different format or the current culture, use the other overloads of the long.ToString(string) method, as follows:
Default ("G") format |
Default (current) culture | |
A specific format |
Default (current) culture | |
A specific format |
A specific culture |
The provider parameter is an object that implements the IFormatProvider interface. Its IFormatProvider.GetFormat(Type) method returns a System.Globalization.NumberFormatInfo object that provides culture-specific information about the format of the string that is returned by this method. The object that implements IFormatProvider can be any of the following:
A System.Globalization.CultureInfo object that represents the culture whose formatting rules are to be used.
A System.Globalization.NumberFormatInfo object that contains specific numeric formatting information for this value.
A custom object that implements IFormatProvider and whose IFormatProvider.GetFormat(Type) method returns a System.Globalization.NumberFormatInfo object that provides formatting information.
If provider is null or a System.Globalization.NumberFormatInfo object cannot be obtained from provider, the return value is formatted with the System.Globalization.NumberFormatInfo object for the current culture.
The .NET Framework provides extensive formatting support, which is described in greater detail in the following formatting topics:
For more information about numeric format specifiers, see Standard Numeric Format Strings and Custom Numeric Format Strings.
For more information about formatting, see Formatting Types.