我在C#中有一个Windows窗体应用程序。我需要将表单数据保存到xml文件。我可以使用字符串C# Tutorial - XML Serialization
保存本教程中给出的文本框中的所有文本我无法弄清楚如何将TreeView和DataGridView序列化为相同的xml文件。试过这里给出的解决方案How to serialize treeview in to xml and deserialize xml back to treeview? 但无法将数据保存到单个xml文件中。在反序列化时,字符串将填充在树视图中而不是节点中。