/** <inheritdoc /> */ public void WriteBinary <T>(T obj, BinaryWriter writer) { var ctx = GetStreamingContext(writer); _serializableTypeDesc.OnSerializing(obj, ctx); var serializable = (ISerializable)obj; var objType = obj.GetType(); // Get field values and write them. var serInfo = new SerializationInfo(objType, new FormatterConverter()); serializable.GetObjectData(serInfo, ctx); var dotNetFields = WriteSerializationInfo(writer, serInfo); // Check if there is any additional information to be written. var customType = GetCustomType(serInfo, serializable); if (dotNetFields != null || writer.Marshaller.Ignite == null || customType != null) { // Set custom type flag in object header. writer.SetCustomTypeDataFlag(true); // Write additional information in raw mode. writer.GetRawWriter(); WriteFieldNames(writer, serInfo); WriteCustomTypeInfo(writer, customType); WriteDotNetFields(writer, dotNetFields); } _serializableTypeDesc.OnSerialized(obj, ctx); }