private static void WriteValueImpl(Stream stream, decimal value, byte[] bytes) { var data = decimal.GetBits(value); Int32Serializer.WriteValueImpl(stream, data[0], bytes); Int32Serializer.WriteValueImpl(stream, data[1], bytes); Int32Serializer.WriteValueImpl(stream, data[2], bytes); Int32Serializer.WriteValueImpl(stream, data[3], bytes); }
public override void WriteValue(Stream stream, object value, SerializerSession session) { var bytes = session.GetBuffer(Int32Serializer.Size); var data = decimal.GetBits((decimal)value); Int32Serializer.WriteValueImpl(stream, data[0], bytes); Int32Serializer.WriteValueImpl(stream, data[1], bytes); Int32Serializer.WriteValueImpl(stream, data[2], bytes); Int32Serializer.WriteValueImpl(stream, data[3], bytes); }
private static void WriteValues <T>(T[] array, Stream stream, ValueSerializer elementSerializer, SerializerSession session) { Int32Serializer.WriteValueImpl(stream, array.Length, session); if (typeof(T).IsFixedSizeType()) { var size = typeof(T).GetTypeSize(); var result = new byte[array.Length * size]; Buffer.BlockCopy(array, 0, result, 0, result.Length); stream.Write(result); } else { foreach (var value in array) { elementSerializer.WriteValue(stream, value, session); } } }
public override void WriteValue(Stream stream, object value, SerializerSession session) { Int32Serializer.WriteValueImpl(stream, (int)value, session); }