Skip to main content

Definition

Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml.Serialization Inheritance: CloudNimble.Text.Xml.Serialization.XmlArrayItemAttribute

Syntax

Summary

Specifies the element name of the items of type T in a collection member. This class cannot be inherited.

Usage

Apply [XmlArrayItem] together with [XmlArray] to name the item elements inside the wrapper element of a collection.
The code produces the following output:
View the complete sample on GitHub

Type Parameters

  • T - The type of the items that the element name applies to.

Considerations

  • The attribute has an effect only on a wrapped collection: one with [XmlArray], or one that DefaultCollectionMapping = XmlCollectionMapping.Wrapped wraps. On a collection with no wrapper, the repeated elements keep the member’s name. To rename those, use [XmlElement("Name")] or [XmlPropertyName("Name")] on the member.
  • Without the attribute, each item of a wrapped collection is named after its type: int, string, and the other XML Schema names for built-in types, and the type’s name, converted by the element naming policy, otherwise.
  • A name set here isn’t converted by a naming policy.
  • Namespace is the namespace of the items of a collection in a wrapper, which is a member with [XmlArray]. Left null, an item is written under its name alone, so it is in the namespace of its wrapper when the wrapper has one. An empty string puts the items in no namespace (xmlns=""). This is what System.Xml.Serialization writes.
  • With no wrapper the item is the element of the member, so Namespace names nothing: the item has the namespace of the member.
  • When a collection is read, every element in the wrapper is an item, whatever its name and namespace.
  • For collections whose items are of different derived types, see Polymorphism.

Constructors

.ctor

Initializes a new instance of the XmlArrayItemAttribute1` class that uses the default item element name.

Syntax

.ctor

Initializes a new instance of the XmlArrayItemAttribute1` class with the specified item element name.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from CloudNimble.Text.Xml.Serialization.XmlArrayItemAttribute
Initializes a new instance of the XmlArrayItemAttribute class that uses the default item element name.

Syntax

.ctor Inherited

Inherited from CloudNimble.Text.Xml.Serialization.XmlArrayItemAttribute
Initializes a new instance of the XmlArrayItemAttribute class with the specified item element name.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from System.Attribute

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

ElementName Inherited

Inherited from CloudNimble.Text.Xml.Serialization.XmlArrayItemAttribute
Gets or sets the local name of the item elements.

Syntax

Property Value

Type: string? The local name of the item elements. If the value is null or empty, the name of the item type is used for a collection wrapped by XmlArrayAttribute, converted by the element naming policy, and the member’s element name is used for a collection that is not wrapped. The default is null.

Namespace Inherited

Inherited from CloudNimble.Text.Xml.Serialization.XmlArrayItemAttribute
Gets or sets the namespace URI of the item elements.

Syntax

Property Value

Type: string? The namespace URI of the item elements. The default is null, which writes an item under its name alone, so it is in the default namespace that is in scope: the namespace of the wrapper when the wrapper has one. An empty string puts the items in no namespace.

Remarks

The value applies to the items of a collection in a wrapper, which is a member with XmlArrayAttribute. With no wrapper an item is the element of the member, and has the namespace of the member. The value is used when the items are written. When they are read, every element in the wrapper is an item, whatever its name and namespace.

Type Override

Syntax

Property Value

Type: System.Type

Type Inherited Virtual

Inherited from CloudNimble.Text.Xml.Serialization.XmlArrayItemAttribute
Gets the item type that XmlArrayItemAttribute.ElementName applies to.

Syntax

Property Value

Type: System.Type? The item type, or null if the element type of the collection is used.

TypeId Inherited Virtual

Inherited from System.Attribute

Syntax

Property Value

Type: object

Methods

Equals Override

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetHashCode Override

Inherited from System.Attribute

Syntax

Returns

Type: int

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

IsDefaultAttribute Inherited Virtual

Inherited from System.Attribute

Syntax

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

Match Inherited Virtual

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?
  • CloudNimble.Text.Xml.Serialization.XmlArrayAttribute
  • CloudNimble.Text.Xml.Serialization.XmlElementAttribute
  • CloudNimble.Text.Xml.Serialization.XmlPropertyNameAttribute
  • CloudNimble.Text.Xml.Serialization.XmlDerivedTypeAttribute