Convert various data type to string with BitConverter
using System; class BitConverterDemo { public static void Main() { double aDoubl = 0.1; float aSingl = 0.3F; long aLong = 2; int anInt = 4; short aShort = 5; char aChar = '*'; bool aBool = true; Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(aDoubl))); Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(aSingl))); Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(aLong))); Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(anInt))); Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(aShort))); Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(aChar))); Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes(aBool))); } }