我有一个XML文档,其中包含多个以下内容:
- <LabelFieldBO>
<Height>23</Height>
<Width>100</Width>
<Top>32</Top>
<Left>128</Left>
<FieldName>field4</FieldName>
<Text>aoi_name</Text>
<DataColumn>aoi_name</DataColumn>
<FontFamily>Arial</FontFamily>
<FontStyle>Regular</FontStyle>
<FontSize>8.25</FontSize>
<Rotation>0</Rotation>
<LabelName />
<LabelHeight>0</LabelHeight>
<LabelWidth>0</LabelWidth>
<BarCoded>false</BarCoded>
</LabelFieldBO>
我已经找到了LabelName = 'container'的元素。但是我不太熟悉lambda表达式,想知道如何访问LINQ结果中的信息。也许lambda表达式并不是最好的选择。我对任何建议都持开放态度。
var dimensions = from field in xml.Elements("LabelFieldBO")
where field.Element("LabelName").Value == "container"
select field;
谢谢。
编辑:我想弄清楚的是如何从XML中获取LabelName =“container”的LabelHeight和LabelWidth。