Parses a specified value in a specified base.
[Visual Basic] Overloads Public Shared Function ToUInt16( _ ByVal value As String, _ ByVal fromBase As Integer _ ) As UInt16 [C#] public static ushort ToUInt16( string value, int fromBase ); [C++] public: static unsigned short ToUInt16( String* value, int fromBase ); [JScript] public static function ToUInt16( value : String, fromBase : int ) : UInt16;
The UInt16 representation of value as a base fromBase number .
Exception Type | Condition |
---|---|
ArgumentException | fromBase is not 2, 8, 10, or 16. |
FormatException | value cannot be parsed as a base fromBase number. |
ArgumentNullException | value is null. |
OverflowException | The value represented by value is greater than UInt16.MaxValue or less than UInt16.MinValue. |
If fromBase is 16, the number may be preceded by "0x"; any other leading or trailing characters cause an error.
Convert Class | Convert Members | System Namespace | Convert.ToUInt16 Overload List