views:

49

answers:

2
+1  Q: 

Linq to RSS feed?

What I'm trying to do is take an RSS feel URL and, using LINQ, be able to write a query that will let me sort the subject line of the feed or sort the author line of the feed or even do 'WHERE' clauses that will let me filter by keywords for example.

I know I can read the RSS feed, parse each element, put them into some sort of class object collection and LINQ off that, but I was wondering if Microsoft provided a simpler way to do this in the .NET framework.

+3  A: 

Maybe this is what you are searching for:

http://codebetter.com/blogs/jeffrey.palermo/archive/2007/10/13/linq-to-xml-querying-an-rss-feed.aspx

Andreas Rehm
This is useful too! Thanks!
icemanind
+2  A: 

You should have a look a the SyndicationFeed class.

var reader = XmlReader.Create("http://url.to/rss");
var feed = SyndicationFeed.Load(reader);

//Find items by Jesper
feed.Items.Where(i=>i.Authors.Any(p=>p.Name == "Jesper"));

//Order by publish date
var ordered = feed.Items.OrderBy(i=>i.PublishDate);
Jesper Palm