Format ulong with the standard format specifiers in CSharp
Description
The following code shows how to format ulong with the standard format specifiers.
Example
using System;/*from w w w .j a va 2s.c o m*/
public class Example
{
public static void Main()
{
ulong value = 163249057;
// Display value using default ToString method.
Console.WriteLine(value.ToString());
Console.WriteLine();
// Define an array of format specifiers.
string[] formats = { "G", "C", "D", "F", "N", "X" };
// Display value using the standard format specifiers.
foreach (string format in formats)
Console.WriteLine("{0} format specifier: {1,16}",format, value.ToString(format));
}
}
The code above generates the following result.