Returns a string representation of the value of the current instance.
- format
- A string that specifies the format of the returned string.
A string representation of the current instance formatted as specified by format. The string takes into account the current system culture.
Type Reason FormatException format is invalid.
This method is equivalent to ulong.ToString(format, null).
If format is a null reference, the general format specifier "G" is used.
This example demonstrates converting a ulong to a string.
C# Example
using System; public class UInt64ToStringExample { public static void Main() { UInt64 i = 64; Console.WriteLine(i); String[] formats = {"c", "d", "e", "f", "g", "n", "p", "x" }; foreach(String str in formats) Console.WriteLine("{0}: {1}", str, i.ToString(str)); } }The output is
64
c: $64.00
d: 64
e: 6.400000e+001
f: 64.00
g: 64
n: 64.00
p: 6,400.00 %
x: 40
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0