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;
The converted value.
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. |
The implementation is the same as FromString.
Convert Class | Convert Members | System Namespace | Convert.ToUInt16 Overload List