C# Convert ToSingle(Boolean)
Description
Convert ToSingle(Boolean)
converts the specified Boolean
value to the equivalent single-precision floating-point number.
Syntax
Convert.ToSingle(Boolean)
has the following syntax.
public static float ToSingle(
bool value
)
Parameters
Convert.ToSingle(Boolean)
has the following parameters.
value
- The Boolean value to convert.
Returns
Convert.ToSingle(Boolean)
method returns The number 1 if value is true; otherwise, 0.
Example
//ww w . j a v a 2 s . c om
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine(Convert.ToSingle(true));
}
}
The code above generates the following result.