System.Xml.XmlConvert.ToSingle Method

Converts the string to a float equivalent.

Syntax

public static float ToSingle (string s)

Parameters

s
The string to convert.

Returns

A Single equivalent of the string.

Exceptions

TypeReason
ArgumentNullException s is a null reference.
FormatException s is not in the correct format.
OverflowException s represents a number less than float.MinValue or greater than float.MaxValue.

Remarks

If s is INF or -INF, this method returns Single.PositiveInfinity or Single.NegativeInfinity respectively.

Requirements

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