[LINQ] List列表,如何制作? [英] [LINQ] List of List, how to make it ?
本文介绍了[LINQ] List列表,如何制作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道如何进一步。
如何将以下代码转换为LINQ样式(我的意思是 List_of_List )?
How can I make the following code into LINQ style (I mean List_of_List) ?
此代码效果很好,100%是我想要的 - 它使List_of_List。
This code works well, 100% what I wanted - it makes List_of_List.
List<List<string>> myContainer = new List<List<string>>();
foreach (XElement x in XDocument.Load(myPath).Descendants("Foo"))
{
List<string> myTemp = new List<string>();
foreach (XElement y in x.Descendants("Boo"))
myTemp.Add(y.Attribute("FoBo").Value);
myContainer.Add(myTemp);
}
谢谢...
thanks...
推荐答案
您是否有实际XML的示例?
Do you have an example of the actual XML?
这篇关于[LINQ] List列表,如何制作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文