Most base types can be converted to a byte array using BitConverter.GetBytes:
To convert byte array to base type, use BitConverter methods, such as ToDouble.
using System; class MainClass//from ww w . j a v a 2 s . c o m { public static void Main(string[] args) { foreach (byte b in BitConverter.GetBytes (123.5)) Console.Write (b + " "); } }