Beispiel #1
0
        public static decimal ReadDecimal(this Message msg)
        {
            UIntDecimal converter = new UIntDecimal();

            converter.longValue1 = msg.ReadUInt64();
            converter.longValue2 = msg.ReadUInt64();
            return(converter.decimalValue);
        }
Beispiel #2
0
        public static void WriteDecimal(this Message msg, decimal value)
        {
            // the only way to read it without allocations is to both read and
            // write it with the FloatConverter (which is not binary compatible
            // to writer.Write(decimal), hence why we use it here too)
            UIntDecimal converter = new UIntDecimal {
                decimalValue = value
            };

            msg.WriteUInt64(converter.longValue1);
            msg.WriteUInt64(converter.longValue2);
        }