C# Convert ToSingle(String)
Description
Convert ToSingle(String)
converts the specified string
representation of a number to an equivalent single-precision floating-point
number.
Syntax
Convert.ToSingle(String)
has the following syntax.
public static float ToSingle(
string value
)
Parameters
Convert.ToSingle(String)
has the following parameters.
value
- A string that contains the number to convert.
Returns
Convert.ToSingle(String)
method returns A single-precision floating-point number that is equivalent to the number
in value, or 0 (zero) if value is null.
Example
/*from w w w .java2 s . com*/
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine(Convert.ToSingle("123"));
}
}
The code above generates the following result.