How can I XML-serialize the following property:
public class SomeCollection
{
[Xml???]
public SomeClass this[int i]
{
get { ... }
set { ... }
}
}
I have tried using XmlElement, XmlArray and XmlArrayItem, to no avail.
The
XmlSerializerdoesn’t work on Indexers, you would either have to implementIXmlSerializableor (better) use a surrogate property to do the heavy lifting for you.