private void WriteObjectUsingReflection(PrimitiveWriter primitiveWriter, object o) { // the primitiveWriter parameter is not used here in fact, it is only to have // signature compatible with the generated method Helpers.InvokeAttribute(typeof(PreSerializationAttribute), o); var type = o.GetType(); if(!WriteSpecialObject(o)) { WriteObjectsFields(o, type); } Helpers.InvokeAttribute(typeof(ImmediatePostSerializationAttribute), o); var postHook = Helpers.GetDelegateWithAttribute(typeof(PostSerializationAttribute), o); if(postHook != null) { postSerializationHooks.Push(postHook); } }
private void PrepareForNextWrite() { if(writer != null) { writer.Dispose(); } identifier = new ObjectIdentifier(); writer = new PrimitiveWriter(stream); inlineWritten = new HashSet<int>(); }