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!

Single.FromString

Converts a String to a float.

[Visual Basic]
Public Shared Function FromString( _
   ByVal s As String _
) As Single
[C#]
public static float FromString(
   string s
);
[C++]
public: static float FromString(
   String* s
);
[JScript]
public static function FromString(
   s : String
) : float;

Parameters

s
The string containing a number to convert.

Return Value

Returns the Single value of the string.

Exceptions

Exception Type Condition
ArgumentException If the string is a null reference (in Visual Basic Nothing).
FormatException If the string does not contain a real number.

Remarks

The default (locale-neutral) NumberFormatInfo is used. Use Parse and Format for locale dependent strings. (In addition see CultureInfo.)

The FromString method does not throw a FormatException if the string is not a number (see NaN); it returns NaN instead. Nor does it throw an OverflowException; it returns PositiveInfinity or NegativeInfinity if the number is too large or too small.

The output from ToString should be consumable by FromString().

See Also

Single Structure | Single Members | System Namespace | Parse