public object GetObject(byte[] bytes, ref int index) { var b = new byte[16]; Buffer.BlockCopy(bytes, index, b, 0, 16); index += 16; return(BitConverterExt.ToDecimal(b)); }
public void AddBytes(object obj, byte[] bytes, ref int index) { //byte[] decimalBytes = BitConverterExt.GetBytes(testDecimal); var b = BitConverterExt.GetBytes((decimal)obj); if (b.Length != 16) { throw new ArgumentException($"Decimal bytes lenght should be length of 16 but is {b.Length}"); } bytes.AddBytes(b, ref index); }