SByte.ToString Method (IFormatProvider)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- provider
- Type: System.IFormatProvider
An object that supplies culture-specific formatting information.
Return Value
Type: System.StringThe string representation of the value of this instance, as specified by provider.
Implements
IConvertible.ToString(IFormatProvider)The returned string is formatted with the general numeric format specifier ("G").
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 Nothing, the SByte 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 SByte 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.
The following example defines a custom NumberFormatInfo object and assigns the "~" character to its NegativeSign property. The example then uses this custom object as well as the NumberFormatInfo object of the invariant culture to format a series of SByte values.