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.Parse (String, NumberStyles)

This method converts a String to a numeric value.

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

Parameters

s
The string to be interpreted.
style
The permitted s pecifiedstyle of the numeric string. It must be a combination of bit flags from the NumberStyles enumeration.

Return Value

A Single value represented by the string parameter.

Exceptions

Exception Type Condition
ArgumentNullException If the string is a null reference (in Visual Basic Nothing).
ArgumentException If the style is not a combination of bit flags from the NumberStyles enumeration.
FormatException If the string is not the correct format.
OverflowException If the string represents a number that is less than Single.MinValue or greater than Single.MaxValue.

Remarks

The numeric format information is obtained from the current locale.

If s has been created by one of the Format methods using C, D, E, F, G, or N as the format specifier, it is guaranteed that s can be parsed when style is NumberStyles enumeration.

The Parse 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.

See Also

Single Structure | Single Members | System Namespace | Single.Parse Overload List | NumberStyles | CultureInfo | NumberFormatInfo | PositiveInfinity | NegativeInfinity | NaN | FromString | ToString