public static void Main()
Console.WriteLine("Boolean Value Before Conversion: " + boolVal);
byte[] boolVal_AsByteArray = BitConverter.GetBytes(boolVal);
Console.WriteLine("Bool Value As Byte: [{0}]", string.Join(", ", boolVal_AsByteArray));
boolVal = BitConverter.ToBoolean(boolVal_AsByteArray, 0);
Console.WriteLine("Boolean Value After Conversion: " + boolVal);
Console.WriteLine("Char Value Before Conversion: " + charVal);
byte[] charVal_AsByteArray = BitConverter.GetBytes(charVal);
Console.WriteLine("Char Value As Byte Array: [{0}]", string.Join(", ", charVal_AsByteArray));
charVal = BitConverter.ToChar(charVal_AsByteArray, 0);
Console.WriteLine("Char Value After Conversion: " + charVal);
decimal decimalVal = Decimal.MaxValue;
Console.WriteLine("Decimal Value Before Conversion: " + decimalVal);
int[] decimalVal_AsIntArray = Decimal.GetBits(decimalVal);
byte[] decimalVal_AsByteArray = new byte[decimalVal_AsIntArray.Length * sizeof(int)];
Buffer.BlockCopy(decimalVal_AsIntArray, 0, decimalVal_AsByteArray, 0, decimalVal_AsByteArray.Length);
Console.WriteLine("Decimal Value As Byte Array: [{0}]", string.Join(", ", decimalVal_AsByteArray));
decimalVal_AsIntArray = new int[decimalVal_AsByteArray.Length / sizeof(int)];
Buffer.BlockCopy(decimalVal_AsByteArray, 0, decimalVal_AsIntArray, 0, decimalVal_AsByteArray.Length);
decimalVal = new Decimal(decimalVal_AsIntArray);
Console.WriteLine("Decimal Value After Conversion: " + decimalVal);
double doubleVal = Double.MaxValue;
Console.WriteLine("Double Value Before Conversion: " + doubleVal);
byte[] doubleVal_AsByteArray = BitConverter.GetBytes(doubleVal);
Console.WriteLine("Double Value As Byte Array: [{0}]", string.Join(", ", doubleVal_AsByteArray));
doubleVal = BitConverter.ToDouble(doubleVal_AsByteArray, 0);
Console.WriteLine("Double Value After Conversion: " + doubleVal);
float floatVal = Single.MaxValue;
Console.WriteLine("Float Value Before Conversion: " + floatVal);
byte[] floatVal_AsByteArray = BitConverter.GetBytes(floatVal);
Console.WriteLine("Float Value As Byte Array: [{0}]", string.Join(", ", floatVal_AsByteArray));
floatVal = BitConverter.ToSingle(floatVal_AsByteArray, 0);
Console.WriteLine("Float Value After Conversion: " + floatVal);
Console.WriteLine("Integer Value Before Conversion: " + intVal);
byte[] intVal_AsByteArray = BitConverter.GetBytes(intVal);
Console.WriteLine("Integer Value As Byte Array: [{0}]", string.Join(", ", intVal_AsByteArray));
intVal = BitConverter.ToInt32(intVal_AsByteArray, 0);
Console.WriteLine("Integer Value After Conversion: " + intVal);
uint uIntVal = 4294967295;
Console.WriteLine("Unsigned Integer Value Before Conversion: " + uIntVal);
byte[] uIntVal_AsByteArray = BitConverter.GetBytes(uIntVal);
Console.WriteLine("Unsigned Integer Value As Byte Array: [{0}]", string.Join(", ", uIntVal_AsByteArray));
uIntVal = BitConverter.ToUInt32(uIntVal_AsByteArray, 0);
Console.WriteLine("Unsigned Integer Value After Conversion: " + uIntVal);
long longVal = 9223372036854775807;
Console.WriteLine("Long Value Before Conversion: " + longVal);
byte[] longVal_AsByteArray = BitConverter.GetBytes(longVal);
Console.WriteLine("Long Value As Byte Array: [{0}]", string.Join(", ", longVal_AsByteArray));
longVal = BitConverter.ToInt64(longVal_AsByteArray, 0);
Console.WriteLine("Long Value After Conversion: " + longVal);
ulong uLongVal = 8446744073709551615;
Console.WriteLine("Unsigned Long Value Before Conversion: " + uLongVal);
byte[] uLongVal_AsByteArray = BitConverter.GetBytes(uLongVal);
Console.WriteLine("Unsigned Long Value As Byte Array: [{0}]", string.Join(", ", uLongVal_AsByteArray));
uLongVal = BitConverter.ToUInt64(uLongVal_AsByteArray, 0);
Console.WriteLine("Unsigned Long Value After Conversion: " + uLongVal);
Console.WriteLine("Short Value Before Conversion: " + shortVal);
byte[] shortVal_AsByteArray = BitConverter.GetBytes(shortVal);
Console.WriteLine("Short Value As Byte Array: [{0}]", string.Join(", ", shortVal_AsByteArray));
shortVal = BitConverter.ToInt16(shortVal_AsByteArray, 0);
Console.WriteLine("Short Value After Conversion: " + shortVal);
ushort uShortVal = 65535;
Console.WriteLine("Unsigned Short Value Before Conversion: " + uShortVal);
byte[] uShortVal_AsByteArray = BitConverter.GetBytes(uShortVal);
Console.WriteLine("Unsigned Short Value As Byte Array: [{0}]", string.Join(", ", uShortVal_AsByteArray));
uShortVal = BitConverter.ToUInt16(uShortVal_AsByteArray, 0);
Console.WriteLine("Unsigned Short Value After Conversion: " + uShortVal);