The Convert class in .NET provides conversion functionality from one data type to another data type. These data types include Boolean, Byte, Char, DateTime, Decimal, Double, Int16, Int32, Int64, SByte, Single, String, UInt16, UInt32, and UInt64.
Byte Conversions
A byte is an 8-bit unsigned integer. The ToByte method of the Convert class converts other base data types to a byte data type.
Convert a Char to a Byte
The following code converts a Boolean data type to a byte.
// Convert char type to ByteConsole.WriteLine("Convert Char type to Byte");char ch = 'M'; byte charByte = Convert.ToByte(ch);Console.WriteLine("{0} converted to {1}.", ch, charByte);