Mono Class Library: System.Single Overview | Members

System.Single.Parse Method

Returns the specified string converted to a float value.

public static float Parse (string s)

Parameters

s
A string containing the value to convert. The string is interpreted using the System.Globalization.NumberStyles.Float and/or System.Globalization.NumberStyles.AllowThousands style.

Returns

The float value obtained from s. If s equals System.Globalization.NumberFormatInfo.NaNSymbol, this method returns float.NaN .

Exceptions

TypeReason
ArgumentNullExceptions is a null reference.
FormatExceptions is not in the correct style.
OverflowExceptions represents a value that is less than float.MinValue or greater than float.MaxValue.

Remarks

This version of float.Parse(string) is equivalent to float.Parse(string)(s, System.Globalization.NumberStyles.Float| System.Globalization.NumberStyles.AllowThousands, null ).

The string s is parsed using the formatting information in a System.Globalization.NumberFormatInfo initialized for the current system culture.

Note: For more information, see System.Globalization.NumberFormatInfo.CurrentInfo.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0