Converts a string to a UInt16 value.
[Visual Basic] Overridable Public Function ToUInt16() As UInt16 [C#] public virtual ushort ToUInt16(); [C++] public: virtual unsigned short ToUInt16(); [JScript] public function ToUInt16() : UInt16;
The UInt16 representation of the string .
Exception Type | Condition |
---|---|
ArgumentException | If the string is not base 2, 8, 10, or 16. |
ArgumentException | If the string is null. |
FormatException | If the string cannot be parsed as a base number or the value represented is greater than UInt16.MaxValue or less than UInt16.MinValue. |
If the string is 16, the number may be preceded by "0x"; any other leading or trailing characters cause an error.