While working through some examples for my book that use the SyndicationFeed and SyndicationItem classes to manage RSS and ATOM data, I wrote this little LINQ to Objects query that mashes items from several different feeds together, and sorts them by date. Its pretty basic LINQ, but when combined with the way cool SyndicationFeed and SyndicationItem classes, I think its pretty darn awesome. :) I’m just thrilled we have these types of tools at our disposal, instead of writing RSS/ATOM parsing routines from scratch using the XmlReader. I’ve done that waaaaaaay too often … but not anymore.


var query = from f in _feeds
from i in f.Items
orderby i.PublishDate descending
select i;


Dim query = _
From f In _feeds , i In f.Items _
Order By i.PublishDate Descending _
Select i

The _feeds variable is a ObservableCollection<SyndicationFeed> in the above code.

DotNetKicks Image