Compartir a través de


UInt16.ToString Method (String)

Converts the value of the current UInt16 object to its equivalent string representation, using a specified format.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

public string ToString (
         string format
)

Parameters

  • format
    A string that takes the form Axx, where A is an alphabetic character called the format specifier, and xx is an optional integer called the precision specifier. The precision specifier ranges from 0 to 99 and affects the number of digits in the result.

    If format is a null reference or an empty string, the general format specifier, 'G', is used.

    The following table describes the standard UInt16 format specifiers.

    Format specifier Name Description
    F or f Fixed Point

    The number is converted to a string of the form "ddd.ddd…" where each 'd' indicates a digit (0-9).

    The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default numeric precision is 2.

    G or g General

    The number is converted to a string of decimal digits (0-9). The precision specifier is ignored.

    N or n Number The number is converted to a string of the form "d,ddd,ddd.ddd…", where 'd' indicates a digit (0-9), ',' indicates a thousand separator between number groups, and '.' indicates a decimal point symbol. The actual number group size and thousand separator are specified by the current NumberFormatInfo object. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default numeric precision is 2.

Return Value

A string representation of the value of the current UInt16 object, in the specified format.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

UInt16 Structure
UInt16 Members
System Namespace