C# UInt16 ToString(String)
Description
UInt16 ToString(String)
converts the numeric value
of this instance to its equivalent string representation using the specified
format.
Syntax
UInt16.ToString(String)
has the following syntax.
public string ToString(
string format
)
Parameters
UInt16.ToString(String)
has the following parameters.
format
- A numeric format string.
Returns
UInt16.ToString(String)
method returns The string representation of the value of this instance as specified by format.
Example
The following example displays a 16-bit unsigned integer value by using each standard format string and some custom format strings.
using System;//from ww w. j a va2 s . co m
using System.Globalization;
public class Example
{
public static void Main()
{
ushort value = 12345;
string[] specifiers = { "G", "C", "D3", "E2", "e3", "F",
"N", "P", "X", "000000.0", "#.0",
"00000000;(0);**Zero**" };
foreach (string specifier in specifiers)
Console.WriteLine("{0}: {1}", specifier, value.ToString(specifier));
}
}
The code above generates the following result.