How to get DataTable to serialize better?
- by AngryHacker
I have the following code that serializes a DataTable to XML.
StringWriter sw = new StringWriter();
myDataTable.WriteXml(sw);
And this works, however, the serialized XML looks like this:
<NameOfTable>
<NameOfTable>
<ID>1</ID>
<Name>Jack</Name>
</NameOfTable>
<NameOfTable>
<ID>2</ID>
<Name>Frank</Name>
</NameOfTable>
</NameOfTable>
Is there anyway to change the outer <NameOfTable> to, say, <Records> and the inner <NameOfTable> to <Person>?