NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Convert.ToUInt16 (String)

Converts a String to a UInt16.

[Visual Basic]
Overloads Public Shared Function ToUInt16( _
   ByVal value As String _
) As UInt16
[C#]
public static ushort ToUInt16(
   string value
);
[C++]
public: static unsigned short ToUInt16(
   String* value
);
[JScript]
public static function ToUInt16(
   value : String
) : UInt16;

Parameters

value
The number to be converted.

Return Value

The converted value.

Exceptions

Exception Type Condition
ArgumentException If value is null.
FormatException Is thrown if value cannot be parsed or the value represented is greater than UInt32.MaxValue or less than UInt32.MinValue.
OverflowException If value represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. Note that if the beginning of the string value contains a properly formatted numerical value that will result in an overflow and, in addition, the end of the string is improperly formed, it cannot be determined whether an OverflowException or a FormatException will be thrown. This has been implemented this way for performance reasons.

Remarks

The implementation is the same as FromString.

See Also

Convert Class | Convert Members | System Namespace | Convert.ToUInt16 Overload List