Esempio n. 1
0
        internal override void UntypedDeserialize(BufferReader reader, ref object target, SerializationContext context)
        {
            T typedTarget = default(T);

            if (target is T)
            {
                typedTarget = (T)target;
            }
            else
            {
                target = (object)default(T); // when the target is of a different type, we have to allocate a new object (via boxing)
            }

            context.AddDeserializedObject(target);
            this.innerSerializer.Deserialize(reader, ref typedTarget, context);
            CopyToBox(typedTarget, ref target, context);
        }
Esempio n. 2
0
 internal override void UntypedSerialize(BufferWriter writer, object instance, SerializationContext context)
 => this.innerSerializer.Serialize(writer, (T)instance, context);
Esempio n. 3
0
 public override void Clear(ref T target, SerializationContext context)
 => this.innerSerializer.Clear(ref target, context);
Esempio n. 4
0
 public override void Clone(T instance, ref T target, SerializationContext context)
 => this.innerSerializer.Clone(instance, ref target, context);
Esempio n. 5
0
 public override void Deserialize(BufferReader reader, ref T target, SerializationContext context)
 => this.innerSerializer.Deserialize(reader, ref target, context);
Esempio n. 6
0
 public override void Serialize(BufferWriter writer, T instance, SerializationContext context)
 => this.innerSerializer.Serialize(writer, instance, context);