public static decimal ByteArrayToDecimal(byte[] src)
{
// Create a MemoryStream containing the byte array
using (MemoryStream stream = new MemoryStream(src))
{
// Create a BinaryReader to read the decimal from the stream
using (BinaryReader reader = new BinaryReader(stream))
{
// Read and return the decimal from the
// BinaryReader/MemoryStream
return reader.ReadDecimal();
}
}
}