I\'m trying to serialize a dummy collection of orders, where each order contains a product. The collection is serializing fine, but the example product properties inside the
Change into List.
Public List Products {
}
You have to change ICollection to List. An interface isn't serializeable.
[XmlArray("Products")]
public List<Product> Products
{
get
{
return this._products;
}
}
And ProductTest doesn't work because of the missing setter
You can't serialize an interface..
An interface is nothing more than a description of a set of behaviors. It says nothing about the contents of an instance. In particular, although an instance of a class implementing an interface must implement all of its members, it will certainly have properties of its own which need to be serialized.
PS: copied from Serializing interfaces