Sdílet prostřednictvím


SByte.ToString Method (IFormatProvider)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function ToString ( _
    provider As IFormatProvider _
) As String
[SecuritySafeCriticalAttribute]
public string ToString(
    IFormatProvider provider
)

Parameters

Return Value

Type: System.String
The string representation of the value of this instance, as specified by provider.

Implements

IConvertible.ToString(IFormatProvider)

Remarks

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 nulla null reference (Nothing in Visual Basic), 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:

Examples

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.