C# Convert ToString(SByte, IFormatProvider)
Description
Convert ToString(SByte, IFormatProvider)
converts
the value of the specified 8-bit signed integer to its equivalent string
representation, using the specified culture-specific formatting information.
Syntax
Convert.ToString(SByte, IFormatProvider)
has the following syntax.
[CLSCompliantAttribute(false)]//w w w .ja va 2 s.c om
public static string ToString(
sbyte value,
IFormatProvider provider
)
Parameters
Convert.ToString(SByte, IFormatProvider)
has the following parameters.
value
- The 8-bit signed integer to convert.provider
- An object that supplies culture-specific formatting information.
Returns
Convert.ToString(SByte, IFormatProvider)
method returns The string representation of value.
Example
using System;// w w w .j a v a 2 s. co m
using System.Globalization;
class MainClass
{
public static void Main( )
{
NumberFormatInfo provider = new NumberFormatInfo();
provider.NegativeSign = "neg ";
provider.PositiveSign = "pos ";
provider.NumberDecimalSeparator = ".";
provider.NumberGroupSeparator = ",";
provider.NumberGroupSizes = new int[ ] { 3 };
provider.NumberNegativePattern = 0;
Console.WriteLine( Convert.ToString( 12345 ));
Console.WriteLine( Convert.ToString( (SByte)123, provider ) );
}
}
The code above generates the following result.