Convert a specified value to a single-precision floating-point number using the Convert.ToSingle() method in C#.
Here is our bool −
bool boolVal = false;
Now, let us use the ToSingle() method to convert the value to a single precision floating-point.
float floatVal; floatVal = Convert.ToSingle(boolVal);
Example
using System;
public class Demo {
public static void Main() {
bool boolVal = false;
float floatVal;
floatVal = Convert.ToSingle(boolVal);
Console.WriteLine("Converted {0} to {1}", boolVal, floatVal);
}
}Output
Converted False to 0