Linq Support?

Mar 1, 2009 at 10:09 PM
If HtmlAttributeCollection and HtmlNodeCollection implemented IEnumerable<HtmlAttribute> and IEnumerable<HtmlNode> respectivly users of .Net 3.5 would get free Linq support.  Would you be open to patches which compile under .Net 2.0 and enable this support?
Mar 10, 2009 at 4:53 AM
Making a LINQ Provider out of HTML Agility Pack would be neat, albeit a massive pain in the behind.
How about converting it into XML for LINQ to XML to handle. see LINQ to HTML.
I think this approach is a win win.

I'm working on making this faster - thanks to nice commenters - but my scenarios make HTTP requests which dwarf the reparsing time.  Like, uber dwarf.

Give me a bit more info about your html querying scenario.


Mar 15, 2009 at 8:34 PM
Nothing particularly complicated honestly I'm not even suggesting that there should be a Linq provider other than the automatic support 3.5 users get from the Enumerable class.  Basically this boils down to HtmlAttributeCollection and HtmlNodeCollection should implement IEnumerable<HtmlAttribute> and IEnumerable<HtmlNode> rather than IEnumerable.  Really I just like Where better than having to foreach over a set and filter stuff out myself.
Mar 16, 2009 at 7:02 AM
Ah, okay! Is it hard to implement those generic ienumerables?
that's an interesting idea, I'll definitely experiment with it sometime this week.

If you get to it before then, feel free to submit a patch, I'd like to see it too. Would then like to compare performance betweeen linq to objects and linq to XML.

Mar 16, 2009 at 7:16 PM
>> Is it hard to implement those generic ienumerables?

Not at all.  For the more part, it's just changing the Function signatures to be returning HtmlAttribute instead of Object.
Mar 17, 2009 at 1:59 AM
Cool! I had a quick look. This is pretty easy.

I'd submit a patch but it seems these guys haven't accepted patches or done a release in a while.

If any project contributors read this? Can you accept patches for moving forward into CLR 2+?