Mega Code Archive

 
Categories / C# / Data Types
 

Converts byte to Boolean

using System; 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);         }                } }