public override unsafe void Read(void *fieldAddress, SerializerInput input) { if (input.BeginReadSize(out var end)) { _memberSerializer.Read((byte *)fieldAddress, input); input.EndObject(end); } else { ref var instance = ref Unsafe.AsRef <T>(fieldAddress); instance = default; }
public override unsafe void Read(void *fieldAddress, SerializerInput input) { if (input.BeginReadSize(out var end)) { ref var objectInstance = ref Unsafe.AsRef <object>(fieldAddress); if (objectInstance == null) { objectInstance = Activator.CreateInstance(_type); } _memberSerializer.Read((byte *)fieldAddress, input); input.EndObject(end); }