本文介绍了如何使用C#将XML值解析为struct的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我的XML文件在形状下包含许多正方形 < 形状 > < ; Square > < Vertex x = 14897.5924 y = 11950.9914 z = 7200 / > < Vertex x = 14890.3926 y = 11902.4548 z = 7200 / > < 顶点 x = 14878.4702 y = 11854.8577 z = 7200 / > < 顶点 x = 14861.9398 y = 11808.6583 z = 7200 / > < / Square > < Square > ; < / Square > < Vertex x = 14786.5052 y = 12317.1966 z = 7200 / > < 顶点 x = 14815.7348 y = 12277.7851 z = 7200 / > < Vertex x = 14840.9606 y = 12235.6984 z = 7200 / > < Vertex x = 14861.9398 y = 12191.3417 z = 7200 / > < Square > < 顶点 x = 14890.3926 y = 11902.4548 z = 7200 / > < 顶点 x = 14878.4702 y = 11854.8577 z = 7200 / > < Vertex x = 14861.9398 y = 11808.6583 z = 7200 / > < 顶点 x = 14840.9606 y = 11764.3016 z = 7200 / > < / Square > < /形状 > 我的问题是我要将X,Y和Z值添加到 使用结构由Id引用的相应正方形 怎么做解决方案 只是谷歌搜索您可以找到许多教程 [ ^ ]。 I am having an XML file containing many Squares under shapes<Shapes><Square> <Vertex x="14897.5924" y="11950.9914" z="7200" /> <Vertex x="14890.3926" y="11902.4548" z="7200" /> <Vertex x="14878.4702" y="11854.8577" z="7200" /> <Vertex x="14861.9398" y="11808.6583" z="7200" /></Square><Square></Square> <Vertex x="14786.5052" y="12317.1966" z="7200" /> <Vertex x="14815.7348" y="12277.7851" z="7200" /> <Vertex x="14840.9606" y="12235.6984" z="7200" /> <Vertex x="14861.9398" y="12191.3417" z="7200" /><Square> <Vertex x="14890.3926" y="11902.4548" z="7200" /> <Vertex x="14878.4702" y="11854.8577" z="7200" /> <Vertex x="14861.9398" y="11808.6583" z="7200" /> <Vertex x="14840.9606" y="11764.3016" z="7200" /></Square></Shapes>My problem is that I want to add the X, Y and Z values to respective Squares referred by Id using StructsHow to do so 解决方案 Just Googling you may find many tutorials[^] on the argument. 这篇关于如何使用C#将XML值解析为struct的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-21 05:50