Mono Class Library: System.Convert Overview | Members

System.Convert.ToUInt16 Method

Converts a string to a ushort . [Edit]

[System.CLSCompliant(false)]
public static ushort ToUInt16 (string value, IFormatProvider provider)

Parameters

value
The string to be converted. The string is in the System.Globalization.NumberStyles.Integer style. [Edit]
provider
An object that implements the IFormatProvider interface and supplies a System.Globalization.NumberFormatInfo instance containing culture-specific formatting information. [Edit]

Returns

value as a 16-bit unsigned integer. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionvalue is a null reference. [Edit]
FormatExceptionvalue cannot be converted to a numeric value. [Edit]
OverflowExceptionThe numeric value of value is greater than ushort.MaxValue or less than ushort.MinValue. [Edit]

Remarks

This method parses value using the information in the System.Globalization.NumberFormatInfo instance supplied by provider. If provider is null or if a System.Globalization.NumberFormatInfo cannot be obtained from provider, the string is parsed using the formatting information of the current system culture.

This member is not CLS-compliant. For a CLS-compliant alternative, use Convert.ToInt32(object)(string, IFormatProvider).

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0