C# Convert ToBoolean(Int64)
Description
Convert ToBoolean(Int64)
converts the value of the specified
64-bit signed integer to an equivalent Boolean value.
Syntax
Convert.ToBoolean(Int64)
has the following syntax.
public static bool ToBoolean(
long value
)
Parameters
Convert.ToBoolean(Int64)
has the following parameters.
value
- The 64-bit signed integer to convert.
Returns
Convert.ToBoolean(Int64)
method returns true if value is not zero; otherwise, false.
Example
The following example converts an array of Int64 values to Boolean values.
/*from www . j a v a 2 s. com*/
using System;
public class MainClass{
public static void Main(String[] argv){
long[] numbers = { Int64.MinValue, -2, -689, 0, 6121,
4, Int64.MaxValue };
bool result;
foreach (long number in numbers)
{
result = Convert.ToBoolean(number);
Console.WriteLine("{0,-26:N0} --> {1}", number, result);
}
}
}
The code above generates the following result.