I have a field:
public Field[][] fields;
And I want an XML:
<Fields>
<Field x="0" y="0">
...
</Field>
<Field x="0" y="1">
...
</Field>
...
</Fields>
Unfortunately, C# XmlSerializer gives me
<Fields>
<ArrayOfField>
.... some fields here
</ArrayOfField>
<ArrayOfField>
.... some here
</ArrayOfField>
...
</Fields>
How do I achieve this?
Well, actually I don’t need to stick to an array of arrays. The fields do represent a 2D space, so it was a natural choice. Would a Dictionary serialize the way I need?
You can create a property that converts between the array of arrays and a single array: