如何使用C#向struct添加xml值 [英] How to add xml values to struct using C#
本文介绍了如何使用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
这篇关于如何使用C#向struct添加xml值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文