Use BitConvert to convert String, Boolean and Int32
using System;
using System.IO;
class Test {
public static void Main() {
byte[] b = BitConverter.GetBytes(true);
Console.WriteLine(BitConverter.ToString(b));
Console.WriteLine(BitConverter.ToBoolean(b,0));
b = BitConverter.GetBytes(3678);
Console.WriteLine(BitConverter.ToString(b));
// Convert a byte array to an int and display.
Console.WriteLine(BitConverter.ToInt32(b,0));
}
}
Related examples in the same category