如何使用Linq创建Dictionary
(或更好,ConcurrentDictionary
)?使用Linq创建词典
举例来说,如果我有以下XML
<students>
<student name="fred" address="home" avg="70" />
<student name="wilma" address="home, HM" avg="88" />
.
. (more <student> blocks)
.
</students>
装入XDocument doc;
,想要填充ConcurrentDictionary<string, Info>
(其中关键的是名称,Info
是一些类控股地址和平均值。填充Info
不我现在的担忧),我该怎么做?
是“使用LINQ”的一个要求还是趋势? – Vlad
可能的重复:http://stackoverflow.com/questions/1710193/converting-an-xml-document-to-a-dictionary – Christian
@Vlad这是一个趋势 – baruch