tags:

views:

290

answers:

1

I have a result of a xlinq that is an enumerable with id and phones, I want to transform that to a Dictionary, that part is simple, however the part of transforming the phone numbers from a XElement to a string its proving hard

xLinqQuery.ToDictionary(e => e.id, e => e.phones.ToList());

will return Dictionary<int, List<XElement>> what i want is a Dictionary<int, List<String>>

I tried with e.phones.ToList().ForEach(...) some strange SelectMany, etc ot no avail

Thanks

+2  A: 

var dict = xLinqQuery.ToDictionary(e => e.id, e => e.phones.Select(p => p.Value).ToList());

Power