Attributes That Control XML Serialization

Attributes That Control XML Serialization

 

You can apply the attributes in the following table to classes and class members to control the way in which the XmlSerializer serializes or deserializes an instance of the class. To understand how these attributes control XML serialization, see Controlling XML Serialization Using Attributes.

These attributes can also be used to control the literal style SOAP messages generated by an XML Web service. For more information about applying these attributes to an XML Web services method, see XML Serialization with XML Web Services.

For more information about attributes, see Extending Metadata Using Attributes.

Attribute

Applies to

Specifies

frlrfSystemXmlSerializationXmlAnyAttributeAttributeClassTopic

Public field, property, parameter, or return value that returns an array of objects.frlrfSystemXmlXmlAttributeClassTopic

When deserializing, the array will be filled with objects that represent all XML attributes unknown to the schema.frlrfSystemXmlXmlAttributeClassTopic

frlrfSystemXmlSerializationXmlAnyElementAttributeClassTopic

Public field, property, parameter, or return value that returns an array of objects.frlrfSystemXmlXmlElementClassTopic

When deserializing, the array is filled with objects that represent all XML elements unknown to the schema.frlrfSystemXmlXmlElementClassTopic

frlrfSystemXmlSerializationXmlArrayAttributeClassTopic

Public field, property, parameter, or return value that returns an array of complex objects.

The members of the array will be generated as members of an XML array.

frlrfSystemXmlSerializationXmlArrayItemAttributeClassTopic

Public field, property, parameter, or return value that returns an array of complex objects.

The derived types that can be inserted into an array. Usually applied in conjunction with an .frlrfSystemXmlSerializationXmlArrayAttributeClassTopic

frlrfSystemXmlSerializationXmlAttributeAttributeClassTopic

Public field, property, parameter, or return value.

The member will be serialized as an XML attribute.

frlrfSystemXmlSerializationXmlChoiceIdentifierAttributeClassTopic

Public field, property, parameter, or return value.

The member can be further disambiguated by using an enumeration.

frlrfSystemXmlSerializationXmlElementAttributeClassTopic

Public field, property, parameter, or return value.

The field or property will be serialized as an XML element.

frlrfSystemXmlSerializationXmlEnumAttributeClassTopic

Public field that is an enumeration identifier.

The element name of an enumeration member.

frlrfSystemXmlSerializationXmlIgnoreAttributeClassTopic

Public properties and fields.

The property or field should be ignored when the containing class is serialized.

frlrfSystemXmlSerializationXmlIncludeAttributeClassTopic

Public derived class declarations, and return values of public methods for Web Services Description Language (WSDL) documents.

The class should be included when generating schemas (to be recognized when serialized).

frlrfSystemXmlSerializationXmlRootAttributeClassTopic

Public class declarations.

Controls XML serialization of the attribute target as an XML root element. Use the attribute to further specify the namespace and element name.

frlrfSystemXmlSerializationXmlTextAttributeClassTopic

Public properties and fields.

The property or field should be serialized as XML text.

frlrfSystemXmlSerializationXmlTypeAttributeClassTopic

Public class declarations.

The name and namespace of the XML type.

In addition to these attributes, which are all found in the namespace, you can also apply the attribute to a field. The DefaultValueAttribute sets the value that will be automatically assigned to the member if no value is specified.frlrfSystemComponentModelDefaultValueAttributeClassTopicfrlrfSystemxmlserialization

To control encoded SOAP XML serialization, see Attributes That Control Encoded SOAP Serialization.

Show:
© 2016 Microsoft