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.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With