Parses a UInt16 from a String. The UInt16 type is not CLS compliant. The CLS-compliant alternative is Int16.
[C#] public static ushort FromString( string s ); [C++] public: static unsigned short FromString( String* s ); [JScript] public static function FromString( s : String ) : UInt16;
[Visual Basic] The UInt16 type cannot be used in Visual Basic.
The Int16 parsed from s.
Exception Type | Condition |
---|---|
ArgumentNullException | If the string is a null reference (in Visual Basic Nothing). |
FormatException | If the string isn't a real number. |
OverflowException | If the number is greater than positive 32767or less than negative 32768. |
FromString parses an unsigned short from a string.
The default (culture-neutral) is NumberFormatInfo is used (see NumberFormatInfo and CultureInfo for more information for numeric and culture formats).
Use Parse and Format for culture dependent strings.
The output from ToString should be consumable by FromString().
UInt16 Structure | UInt16 Members | System Namespace | String | NumberStyles