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!

UInt16.FromString

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.

Parameters [C#, C++, JScript]

s
A string containing a number.

Return Value [C#, C++, JScript]

The Int16 parsed from s.

Exceptions [C#, C++, JScript]

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.

Remarks [C#, C++, JScript]

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().

See Also

UInt16 Structure | UInt16 Members | System Namespace | String | NumberStyles