C
C#2y ago
ivi

❔ 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
Angius
Angius2y ago
Turn that IQueryable .ToDictionary()
ivi
iviOP2y ago
ivi
iviOP2y ago
it even says that AsQueryable is for turning IEnumerables into Queryables yet Attributes lacks any of the functions to turn it into anything else
Angius
Angius2y ago
Huh
ivi
iviOP2y ago
Angius
Angius2y ago
Out of curiosity, why not deserialize that XML to a good and proper class, instead of parsing it like that?
ivi
iviOP2y ago
the list of attributes is dynamic
Angius
Angius2y ago
Oof
ivi
iviOP2y ago
its not really a big deal, i just dont understand why it wouldnt let me do this basic linq stuff
Angius
Angius2y ago
Ah, huh, apparently only the generic IQueryable<T> has extension method that lets you turn it into a dictionary
ivi
iviOP2y ago
I'm kind of at a loss lol
ivi
iviOP2y ago
And then I try to do this and it gives me object??
ivi
iviOP2y ago
But its clearly XmlAttribute
ivi
iviOP2y ago
Guess it has to be a for loop then or somethin. Just really weird
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server