예제 #1
0
        public static void WriteValue(WriterState writer, decimal val)
        {
            // Decimals are stored as IEEE 754-2008 Decimal128 format https://en.wikipedia.org/wiki/Decimal128_floating-point_format
            // The IEEE version has higher precision than .net's decimal implementation and is compatible with other platforms
            var d = new Decimal128(val);

            writer.Write(d.GetIeeeHighBits());
            writer.Write(d.GetIeeeLowBits());
        }
 public void Write(WriterState writer, IEnumerable list)
 {
     foreach (var item in (IEnumerable <T>)list)
     {
         writer.Write((byte)EnumerableType.HasItem);
         Serializer.WriteNonPrimitive(writer, item);
     }
     writer.Write((byte)EnumerableType.End);
 }
예제 #3
0
 public static void Write(WriterState writer, sbyte val)
 {
     writer.Write((byte)SerializedType.SByte);
     writer.Write(val);
 }
예제 #4
0
 public static void Write(WriterState writer, bool val)
 {
     writer.Write((byte)SerializedType.Bool);
     writer.Write(val);
 }
예제 #5
0
 public static void Write(WriterState writer, float val)
 {
     writer.Write((byte)SerializedType.Float);
     writer.Write(val);
 }
예제 #6
0
 public static void Write(WriterState writer, double val)
 {
     writer.Write((byte)SerializedType.Double);
     writer.Write(val);
 }
예제 #7
0
 public static void WriteValue(WriterState writer, ulong val)
 {
     writer.Write(val);
 }
예제 #8
0
 public static void Write(WriterState writer, uint val)
 {
     writer.Write((byte)SerializedType.UInt);
     writer.Write(val);
 }
예제 #9
0
 public static unsafe void Write(WriterState writer, Guid val)
 {
     writer.Write((byte)SerializedType.Guid);
     val.TryWriteBytes(writer.Reserve(sizeof(Guid)));
 }
예제 #10
0
 public static void WriteValue(WriterState writer, char val)
 {
     writer.Write(val);
 }
예제 #11
0
 public static void WriteValue(WriterState writer, sbyte val)
 {
     writer.Write(val);
 }
예제 #12
0
 public static void Write(WriterState writer, long val)
 {
     writer.Write((byte)SerializedType.Long);
     writer.Write(val);
 }
예제 #13
0
 public static void WriteValue(WriterState writer, float val)
 {
     writer.Write(val);
 }
예제 #14
0
 public static void Write(WriterState writer, string val)
 {
     writer.Write((byte)SerializedType.String);
     writer.WriteString(val);
 }
예제 #15
0
 public static void Write(WriterState writer, char val)
 {
     writer.Write((byte)SerializedType.Char);
     writer.Write(val);
 }
예제 #16
0
 public static void Write(WriterState writer, DateTime val)
 {
     writer.Write((byte)SerializedType.DateTime);
     writer.Write(val.ToUniversalTime().Ticks);
 }
예제 #17
0
 public static void WriteValue(WriterState writer, DateTime val)
 {
     writer.Write(val.ToUniversalTime().Ticks);
 }
예제 #18
0
 public static void Write(WriterState writer, ushort val)
 {
     writer.Write((byte)SerializedType.UShort);
     writer.Write(val);
 }
예제 #19
0
 public static void WriteValue(WriterState writer, ushort val)
 {
     writer.Write(val);
 }