public void Serialize(ref TinyhandWriter writer, TinyhandSerializerOptions options) { writer.WriteArrayHeader(3); options.Resolver.GetFormatter <int>().Serialize(ref writer, this.X, options); options.Resolver.GetFormatter <int>().Serialize(ref writer, this.Y, options); options.Resolver.GetFormatter <int[]>().Serialize(ref writer, this.A, options); }
public void Setup() { this.DateTime = DateTime.UtcNow; var w = new TinyhandWriter(); DateTimeFormatter.Instance.Serialize(ref w, this.DateTime, TinyhandSerializerOptions.Standard); this.DateTimeByte = w.FlushAndGetReadOnlySequence(); w = new TinyhandWriter(); NativeDateTimeFormatter.Instance.Serialize(ref w, this.DateTime, TinyhandSerializerOptions.Standard); this.NativeDateTimeByte = w.FlushAndGetReadOnlySequence(); this.Guid = Guid.NewGuid(); w = new TinyhandWriter(); GuidFormatter.Instance.Serialize(ref w, this.Guid, TinyhandSerializerOptions.Standard); this.GuidByte = w.FlushAndGetReadOnlySequence(); w = new TinyhandWriter(); NativeGuidFormatter.Instance.Serialize(ref w, this.Guid, TinyhandSerializerOptions.Standard); this.NativeGuidByte = w.FlushAndGetReadOnlySequence(); this.Decimal = new Decimal(1341, 53156, 61, true, 3); w = new TinyhandWriter(); DecimalFormatter.Instance.Serialize(ref w, this.Decimal, TinyhandSerializerOptions.Standard); this.DecimalByte = w.FlushAndGetReadOnlySequence(); w = new TinyhandWriter(); NativeDecimalFormatter.Instance.Serialize(ref w, this.Decimal, TinyhandSerializerOptions.Standard); this.NativeDecimalByte = w.FlushAndGetReadOnlySequence(); }
public void Serialize(ref TinyhandWriter writer, GenericsIntClass <T>?v, TinyhandSerializerOptions options) { if (v == null) { writer.WriteNil(); return; } // v.Serialize(ref writer, options); writer.WriteArrayHeader(3); options.Resolver.GetFormatter <T>().Serialize(ref writer, v.X, options); options.Resolver.GetFormatter <T>().Serialize(ref writer, v.Y, options); options.Resolver.GetFormatter <T[]>().Serialize(ref writer, v.A, options); }
public ReadOnlySequence <byte> SerializeNativeDecimal() { var w = new TinyhandWriter(this.ByteBuffer); try { NativeDecimalFormatter.Instance.Serialize(ref w, this.Decimal, TinyhandSerializerOptions.Standard); return(w.FlushAndGetReadOnlySequence()); } finally { w.Dispose(); } }
public static void SerializeCharArray(ref TinyhandWriter writer, char[]?value) { if (value == null) { writer.WriteNil(); } else { writer.WriteArrayHeader(value.Length); for (int i = 0; i < value.Length; i++) { writer.Write(value[i]); } } }
public static void SerializeBooleanList(ref TinyhandWriter writer, List <bool>?value) { if (value == null) { writer.WriteNil(); } else { writer.WriteArrayHeader(value.Count); for (int i = 0; i < value.Count; i++) { writer.Write(value[i]); } } }