C# UInt64 ToString(String, IFormatProvider)
Description
UInt64 ToString(String, IFormatProvider)
converts
the numeric value of this instance to its equivalent string representation
using the specified format and culture-specific format information.
Syntax
UInt64.ToString(String, IFormatProvider)
has the following syntax.
public string ToString(
string format,
IFormatProvider provider
)
Parameters
UInt64.ToString(String, IFormatProvider)
has the following parameters.
format
- A numeric format string.provider
- An object that supplies culture-specific formatting information about this instance.
Returns
UInt64.ToString(String, IFormatProvider)
method returns The string representation of the value of this instance as specified by format
and provider.
Example
The following example displays a 32-bit unsigned integer value by using the standard numeric format specifiers and a number of specific CultureInfo objects.
using System;// w w w. j a v a 2 s .co m
using System.Globalization;
public class Example
{
public static void Main()
{
CultureInfo[] cultures = { CultureInfo.CreateSpecificCulture("en-US"),
CultureInfo.CreateSpecificCulture("fr-FR"),
CultureInfo.CreateSpecificCulture("es-ES") };
string[] specifiers = {"G", "C", "D4", "E2", "F", "N", "P", "X2"};
ulong value = 12345678;
foreach (string specifier in specifiers)
{
foreach (CultureInfo culture in cultures)
Console.WriteLine("{0,2} format using {1} culture: {2, 18}",
specifier, culture.Name,
value.ToString(specifier, culture));
Console.WriteLine();
}
}
}
The code above generates the following result.