Someone asked me today about how to go from a piece of XML which contained key/value pairs to a Dictionary<K,V>. This was the best I could come up with;
Dim xml = <items>
<item key="one" value="A"/>
<item key="two" value="B"/>
<item key="three" value="C"/>
</items>
Dim result = xml...<item>.ToDictionary( _
Function(k) k.@key, _
Function(v) v.@value)
Written here in VB as it's so nice for XML work.
Posted
Fri, Nov 30 2007 9:13 AM
by
mtaulty