Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Convert.ToSingle Method in C#
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
Advertisements
