Okay so this one is filed under the “I keep looking up the same things” category. In .Net 1 lists of objects were commonly serialized either using an Array or an ArrayList property:
....
/// <summary>
/// List Item permissions to be given to this group
/// </summary>
[XmlArray("ListItems"), XmlArrayItem("ListItemPermissions", typeof(ListItemPermissions))]
public ArrayList ListItems
{
get { return _listItems; }
set { _listItems = value; }
}
....
or
....
public Group[] Groups
{
get { return this.groups; }
set { this.groups = value; }
}
In .net 2.0 List<T> can be serialized by adding the XmlArray attribute in the property declaration, as follows:
[XmlArray("Audiences")]
public List<PortalAudience> Audiences { get; set; }
…..