C# Convert ToBoolean(UInt64)
Description
Convert ToBoolean(UInt64)
converts the value of the
specified 64-bit unsigned integer to an equivalent Boolean value.
Syntax
Convert.ToBoolean(UInt64)
has the following syntax.
[CLSCompliantAttribute(false)]
public static bool ToBoolean(
ulong value
)
Parameters
Convert.ToBoolean(UInt64)
has the following parameters.
value
- The 64-bit unsigned integer to convert.
Returns
Convert.ToBoolean(UInt64)
method returns true if value is not zero; otherwise, false.
Example
The following example converts an array of UInt64 values to Boolean values.
//from ww w .j av a 2s . c o m
using System;
public class MainClass{
public static void Main(String[] argv){
ulong[] numbers = { UInt64.MinValue, 1234, 123456789, UInt64.MaxValue };
bool result;
foreach (ulong number in numbers)
{
result = Convert.ToBoolean(number);
Console.WriteLine("{0,-26:N0} --> {1}", number, result);
}
}
}
The code above generates the following result.