Convert byte to Boolean in CSharp
Description
The following code shows how to convert byte to Boolean.
Example
using System;//from w ww . j ava 2 s. c o m
using System.Globalization;
public class Example
{
public static void Main()
{
byte[] bytes = { Byte.MinValue, 100, 200, Byte.MaxValue };
bool result;
foreach (byte byteValue in bytes)
{
result = Convert.ToBoolean(byteValue);
Console.WriteLine("{0,-5} --> {1}", byteValue, result);
}
}
}
The code above generates the following result.