public override void EncodeTyped(ref JsonEncoder encoder, T value) { encoder.Write("{"); bool first = true; foreach (var memberEncoder in this.memberEncoders) { if (!first) { encoder.Write(", "); } else { first = false; } memberEncoder.EncodeTyped(ref encoder, value); } encoder.Write("}"); }
public override void EncodeTyped(ref JsonEncoder encoder, object value) { var type = value.GetType(); if (type == typeof(object)) { encoder.Write("{}"); } else { var typeEncoder = GetEncoder(type); typeEncoder.Encode(ref encoder, value); } }
public override void EncodeTyped(ref JsonEncoder encoder, TInstance instance) { encoder.EncodeString <string>(member.Name); encoder.Write(": "); this.valueEncoder.EncodeTyped(ref encoder, this.member.GetTypedValue(ref instance)); }