如何使用C#向struct添加xml值

问题描述:

我有一个包含多个节点的 XML 文件。



但我想在这些中添加所有属性节点 struct 以便

我可以访问它以供进一步使用。



如何将XML值导入结构



任何人都可以帮我摆脱这个问题

I am having an XML file containing containing multiple nodes.

But I want to add all the attributes in these nodes to struct so that
I can access it for further use.

How to import XML values to Struct

Can anyone help me to get rid of this problem

很抱歉说明显而易见的,但是:



  • 使用其中一个.NET类读取XML数据
  • 循环通过节点提取属性(或其他)数据项
  • 将项添加到结构,数组或列表等。
  • 根据需要处理结果数据
  • 继续钦佩同龄人
Sorry to state the obvious, but:

  • Read the XML data with one of the .NET classes
  • Loop through the nodes extracting the attribute (or other) data items
  • Add the items to your struct, or array, or list etc.
  • Process the resultant data as required
  • Bask in the admiration of your peers