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, NumberFormatInfo)

This method converts a String to a numeric value in the specified style using the formatting information.

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

Parameters

s
The string to be interpreted.
style
The specified style of the numeric string. It must be a combination of bit flags from the NumberStyles enumeration.
info
The NumberFormatInfo instance used to format the string. If this parameter is null the numeric format information is obtained from the current locale.

Return Value

Returns a Single with the value represented by the string parameter.

Exceptions

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

Remarks

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