- value
- The float value to be converted.
true if value is non-zero; false if value is zero.
Documentation for this section has not yet been entered.
The following example demonstrates converting float values to bool values.
C# Example
using System; class ConvertBoolTest { static public void Main() { float float0 = 0.0f; float float1 = 1.0f; float float2 = -2.0f; bool bool0 = Convert.ToBoolean(float0); bool bool1 = Convert.ToBoolean(float1); bool bool2 = Convert.ToBoolean(float2); Console.WriteLine("(float) {0} as bool = {1}",float0,bool0); Console.WriteLine("(float) {0} as bool = {1}",float1,bool1); Console.WriteLine("(float) {0} as bool = {1}",float2,bool2); } }The output is
(float) 0 as bool = False
(float) 1 as bool = True
(float) -2 as bool = True
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0