❔ XMLAttributeCollection -> Dictionary with LINQ?
It's a confusing class. It only allows turning it into a Queryable, but I have no experience with those and would rather not.
How could I turn it into a dictionary of string->string?
15 Replies
Turn that
IQueryable
.ToDictionary()
![](https://utfs.io/f/9550c43f-0a33-4570-b6a1-1beb46701f6e-1nq2cb.png)
it even says that AsQueryable is for turning IEnumerables into Queryables
yet Attributes lacks any of the functions to turn it into anything else
Huh
![](https://utfs.io/f/179b5cab-9a56-4f47-92d3-fa182dd40f01-1nq2cb.png)
Out of curiosity, why not deserialize that XML to a good and proper class, instead of parsing it like that?
the list of attributes is dynamic
Oof
its not really a big deal, i just dont understand why it wouldnt let me do this basic linq stuff
Ah, huh, apparently only the generic
IQueryable<T>
has extension method that lets you turn it into a dictionaryI'm kind of at a loss lol
And then I try to do this and it gives me
object
??![](https://utfs.io/f/2a77b9eb-347e-4fd2-9bbb-f95f1cacf4c8-1nq2cb.png)
But its clearly XmlAttribute
![](https://utfs.io/f/ec8ae924-aff8-4a76-80c6-78ca4b146d27-1nq2cb.png)
Guess it has to be a for loop then or somethin. Just really weird
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.