private WriteSpecialObject ( object o, bool checkForCollections ) : bool | ||
o | object | |
checkForCollections | bool | |
return | bool |
/// <summary> /// Writes the object using reflection. /// /// REMARK: this method is not thread-safe! /// </summary> /// <param name="objectWriter">Object writer's object</param> /// <param name="o">Object to serialize</param> internal static void WriteObjectUsingReflection(ObjectWriter objectWriter, object o) { Helpers.InvokeAttribute(typeof(PreSerializationAttribute), o); if (!objectWriter.WriteSpecialObject(o, !objectWriter.treatCollectionAsUserObject)) { objectWriter.WriteObjectsFields(o, o.GetType()); } }
/// <summary> /// Writes the object using reflection. /// /// REMARK: this method is not thread-safe! /// </summary> /// <param name="objectWriter">Object writer's object</param> /// <param name="o">Object to serialize</param> internal static void WriteObjectUsingReflection(ObjectWriter objectWriter, object o) { Helpers.InvokeAttribute(typeof(PreSerializationAttribute), o); if(!objectWriter.WriteSpecialObject(o, !objectWriter.treatCollectionAsUserObject)) { objectWriter.WriteObjectsFields(o, o.GetType()); } }
private static void WriteObjectUsingReflection(ObjectWriter objectWriter, PrimitiveWriter primitiveWriter, object o) { objectWriter.TouchAndWriteTypeId(o.GetType()); // the primitiveWriter and parameter is not used here in fact, it is only to have // signature compatible with the generated method Helpers.InvokeAttribute(typeof(PreSerializationAttribute), o); try { var type = o.GetType(); objectWriter.currentlyWrittenTypes.Push(type); if(!objectWriter.WriteSpecialObject(o)) { objectWriter.WriteObjectsFields(o, type); } objectWriter.currentlyWrittenTypes.Pop(); } finally { Helpers.InvokeAttribute(typeof(PostSerializationAttribute), o); var postHook = Helpers.GetDelegateWithAttribute(typeof(LatePostSerializationAttribute), o); if(postHook != null) { objectWriter.postSerializationHooks.Add(postHook); } } }