I have a piece of xml like the following:
<Table>
<Record>
<Field>Value1_1</Field>
<Field>Value1_2</Field>
</Record>
<Record>
<Field>Value2_1</Field>
<Field>Value2_2</Field>
</Record>
</Table>
What i would like is a LINQ query that generates an IEnumerable that i can assign as the datasource of a DataGrid. What i have so far is as follows:
var temp = from record in table.Elements("Record")
select record.Element("Field").Value
The fact that I can have multiple field elements is my stumbling block.
In the above example, what i need is something like an IEnumerable<string,string>
.
The datagrid would look something like this:
Value1_1, Value1_2
Value2_1, Value2_2
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…