Specifies that the XmlSerializer must serialize a particular class member as an array of XML elements.
Assembly: System.Xml (in System.Xml.dll)
Thetype exposes the following members.
|ElementName||Gets or sets the XML element name given to the serialized array.|
|Form||Gets or sets a value that indicates whether the XML element name generated by the XmlSerializer is qualified or unqualified.|
|IsNullable||Gets or sets a value that indicates whether the XmlSerializer must serialize a member as an empty XML element with the xsi:nil attribute set to true.|
|Namespace||Gets or sets the namespace of the XML element.|
|Order||Gets or sets the explicit order in which the elements are serialized or deserialized.|
|Equals||Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Returns the hash code for this instance. (Inherited from Attribute.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|Match||When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The belongs to a family of attributes that controls how the XmlSerializer serializes or deserializes an object.
You can apply the to a public field or read/write property that returns an array of objects, a collection, or any class that implements the IEnumerable interface.
When you apply the to a class member, the Serialize method of the XmlSerializer class generates a nested sequence of XML elements from that member. An XML schema document (an .xsd file) indicates such an array as a complexType. For example, if the class to be serialized represents a purchase order, you can generate an array of purchased items by applying the to a public field that returns an array of objects that represent order items.
If no attributes are applied to a public field or property that returns an array of complex or primitive type objects, the XmlSerializer generates a nested sequence of XML elements by default. To more precisely control what XML elements are generated, apply an XmlArrayItemAttribute and an to the field or property. For example, by default, the name of the generated XML element is derived from the member identifier. You can change the name of the generated XML element by setting the ElementName property.
If you serialize an array that contains items of a specific type and all the classes derived from that type, you must use the XmlArrayItemAttribute to declare each of the types.
You can use XmlArray in your code instead of the longer .