Lists can be defined within Serializations and Serializable classes to represent repeating elements in an XML message format.
A List can be defined in either of the following ways:
As a special kind of attribute or variable within classes and interfaces. That is, you can define a List attribute by selecting the List check box in the Add New Attribute dialog box when adding a new attribute or variable.
As a List type. This is a re-usable list definition that can be used in ordinary attributes to define a list through the Template property. You can do this by selecting List in the Add New Item dialog box.
To understand the usage of List we can use the following example. This is a simple XML message with a repeating element:
<?xml version="1.0"?> <People> <Surname>Smith</ Surname > < Surname >Jones</ Surname > < Surname >Harris</ Surname > </People>
To define a List Attribute to represent the repeating <Surname> element, perform the following:
Right-click the Serialization that represents the “People” message format, point to Add, and then select Attribute from the context menu.
The Add New Attribute dialog box appears.
In the Template box, enter or browse to the type that this attribute will derive from. For example, the Primitive type for Surname. This can be any Primitive type, Class, or Serialization.
In the Name box, enter an appropriate name; for example, Surname.
Select the List check box.
Click Create.
A corresponding List attribute must be defined within the class that implements the above Serialization.