C# UInt16 ToString(IFormatProvider)
Description
UInt16 ToString(IFormatProvider)
converts the numeric
value of this instance to its equivalent string representation using the
specified culture-specific format information.
Syntax
UInt16.ToString(IFormatProvider)
has the following syntax.
public string ToString(
IFormatProvider provider
)
Parameters
UInt16.ToString(IFormatProvider)
has the following parameters.
provider
- An object that supplies culture-specific formatting information.
Returns
UInt16.ToString(IFormatProvider)
method returns The string representation of the value of this instance, which consists
of a sequence of digits ranging from 0 to 9, without a sign or leading zeros.
Example
The following example formats a 16-bit signed integer value by using several format providers, including one for the invariant culture.
using System;// w w w . ja v a 2s .c o m
using System.Globalization;
public class Example
{
public static void Main()
{
CultureInfo[] ci = { new CultureInfo("en-US"),
new CultureInfo("fr-FR"),
CultureInfo.InvariantCulture };
UInt16 value = 12345;
Console.WriteLine(value.ToString(ci[0]));
Console.WriteLine(value.ToString(ci[1]));
Console.WriteLine(value.ToString(ci[2]));
}
}
The code above generates the following result.