Note
Compiler-generated backing fields are ignored so types with public auto properties are considered simple.
[FlagsAttribute]
public enum XmlSerializationOptions
<FlagsAttribute>
Public Enumeration XmlSerializationOptions
[FlagsAttribute]
public enum class XmlSerializationOptions
[<FlagsAttribute>]
type XmlSerializationOptions
None | 0x0000 | Represents no enabled options. With every options disabled only those types are serialized, which are guaranteed to be able to deserialized perfectly. Such types are:
|
FullyQualifiedNames | 0x0001 | If enabled, collection elements and non binary-serialized complex objects will be identified by the assembly qualified type name; otherwise, only by full type name. Using fully qualified names makes possible to automatically load the assembly of a referenced type (unless safe mode is used on deserialization). Partial identity match is allowed, so type resolving tolerates assembly version change. When resolving non-fully qualified type names, their assembly must be loaded before the deserialization; otherwise, the type resolving will fail, even in non-safe mode. Default state at serialization methods: Disabled |
BinarySerializationAsFallback | 0x0002 | If a type cannot be parsed natively and has no TypeConverter with String support, then enabling this option makes possible to store its content in binary format (using the BinarySerializationFormatter class) within the XML. Though trusted collections and objects with only public read-write properties and fields can be serialized with the None options as well, using this option will cause to serialize them in binary format, too. If both BinarySerializationAsFallback and RecursiveSerializationAsFallback options are enabled, then binary serialization has higher priority, except for properties that are marked by Content visibility, which causes the property to be serialized recursively. Default state at serialization methods: Disabled |
RecursiveSerializationAsFallback | 0x0004 | If a type cannot be parsed natively, has no TypeConverter with String support or binary serialization is disabled, then enabling this option makes possible to serialize the object by serializing its public properties, fields and collection items recursively. If a property or collection element cannot be serialized, then a SerializationException will be thrown. Properties can be marked by DesignerSerializationVisibilityAttribute with Content value to indicate that they should be serialized recursively without using this fallback option. If both BinarySerializationAsFallback and RecursiveSerializationAsFallback options are enabled, then binary serialization has higher priority, except for properties that are marked by Content visibility, which causes the property to be serialized recursively. Key and Value properties of DictionaryEntry and KeyValuePairTKey, TValue instances are always serialized recursively because those are natively supported types. Default state at serialization methods: Disabled |
CompactSerializationOfStructures | 0x0008 | If a ValueType (struct) has no TypeConverter and contains no references, then by enabling this option the instance will be serialized in a compact binary form. Default state at serialization methods: Disabled |
AutoGenerateDefaultValuesAsFallback | 0x0010 | If enabled, then members without DefaultValueAttribute defined, will be treated as if they were decorated by DefaultValueAttribute with the default value of the property type ( for reference types and bitwise zero value of value types). This causes to skip serializing members, whose value equals to the default value of their type. Default state at serialization methods: Disabled |
IgnoreDefaultValueAttribute | 0x0020 | Ignores the originally defined DefaultValueAttribute definitions for all of the properties. This causes that all members will be serialized regardless of their values. Default state at serialization methods: Disabled |
IgnoreShouldSerialize | 0x0040 | Ignores the presence of ShouldSerialize<PropertyName> methods for all of the members. Default state at serialization methods: Disabled |
IgnoreIXmlSerializable | 0x0080 | If enabled, XmlSerializer ignores IXmlSerializable implementations. Default state at serialization methods: Disabled |
CompactSerializationOfPrimitiveArrays | 0x0100 | If enabled, then array of primitive types are serialized in a single XML node instead of creating XML nodes for each element in the array. Default state at serialization methods: Enabled |
EscapeNewlineCharacters | 0x0200 | Unless a well configured XmlWriter is used, newline characters of string or char values can be lost or changed during deserialization. This flag ensures that newline characters can be always deserialized regardless of the used NewLineHandling value of an XmlWriter. Default state at serialization methods: Enabled |
OmitCrcAttribute | 0x0400 | When this flag is enabled, binary contents will not be protected by a CRC value. Affects CompactSerializationOfPrimitiveArrays, CompactSerializationOfStructures and BinarySerializationAsFallback flags. Default state at serialization methods: Disabled |
ExcludeFields | 0x0800 | By default XmlSerializer includes public fields in serialization, similarly to System.Xml.Serialization.XmlSerializer. By enabling this option, only public properties will be serialized. Default state at serialization methods: Disabled |
ForcedSerializationOfReadOnlyMembersAndCollections | 0x1000 | By default read-only properties and fields are serialized only if they are IXmlSerializable implementations or collections that can be populated. This option forces to serialize read-only fields and properties, as well as collections that are read-only and have no recognizable initializer constructor. Default state at serialization methods: Disabled |
IgnoreTypeForwardedFromAttribute | 0x2000 | When both FullyQualifiedNames and this flag are enabled, then every type will be serialized with its actual assembly identity rather than considering the value of an existing TypeForwardedFromAttribute. This flag is ignored if FullyQualifiedNames is disabled. Default state at serialization methods: Disabled |
IncludeRefProperties | 0x4000 | Indicates that properties with ref return type should also be serialized, which are omitted without using this flag. It treats ref readonly properties like regular read-only properties regarding collections (see the details at the None option). Default state at serialization methods: Disabled |