Example #1
0
                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("}");
                }
Example #2
0
                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);
                    }
                }
Example #3
0
 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));
 }