问题
Is there any way to add fields to a DataSet which will be serialized along with the table information when the DataSet is serialized in XML? I have some information that describes the DataSet that I want to try to include inside it when I throw it around in XML. I've tried adding fields and classes in the partial class Visual Studio generates for you for validation methods but I can't seem to get them to show up alongside the table information in the XML file either when myDataSet.WriteXML() or I use an XMLSerializer.
回答1:
I haven't ever tried it, but the ExtendedProperties property of DataSet is supposed to be just for this. It lets you store information which is persisted when the DataSet is serialised to XML.
来源:https://stackoverflow.com/questions/1408517/serializing-fields-in-a-custom-dataset-to-xml