transform List<XElement> to List<XElement.Value>

Posted by Miau on Stack Overflow See other posts from Stack Overflow or by Miau
Published on 2009-08-25T01:46:01Z Indexed on 2010/04/17 20:03 UTC
Read the original article Hit count: 453

Filed under:

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

© Stack Overflow or respective owner

Related posts about xlinq