Given a (contrived) base class, and a sub class we want to serialize via WCF using the XmlSerializer. We decorate a collection (see the response class) as per the article:>
Because you are using [XmlElement] on the collection property, the corresponding xml is going to be something like:
{this is a user}
{this is a user}
{this is a super user}
{this is a user}
{this is a super user}
there isn't really anywhere it can get a better name for a collection property, other than Items. I wonder if it might be better to use:
[XmlArray("Users")]
[XmlArrayItem("User", typeof(User))]
[XmlArrayItem("SuperUser", typeof(SuperUser))]
in order to build:
{this is a user}
{this is a user}
{this is a super user}
{this is a user}
{this is a super user}
then you would have a Users property.