Build an RSS reader in 5 minutes

Today, I stumbled upon a very handy class : SyndicationFeed. This class, introduced in .NET 3.5, allows to manipulate syndication feeds (like RSS 2.0 or Atom 1.0) with very little code. It can be used to create and publish our own feeds, or to read existing ones.

For instance, here’s how to retrieve the news feed from Google News and display its title, its hyperlink, and the titles of it’s items :

string url = "";
using (XmlReader reader = XmlReader.Create(url))
    SyndicationFeed feed = SyndicationFeed.Load(reader);
    foreach(SyndicationItem item in feed.Items)

Easy enough, don’t you think ? 🙂

Let’s now take advantage of WPF binding capabilities to create a very simple graphical RSS reader :

<Window x:Class="TestFeeds.Window1"
        Title="Minimalist feed reader" Height="286" Width="531">
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        <DockPanel Grid.Row="0">
            <Button Name="btnGo"
                    Click="btnGo_Click" />
            <TextBox Name="txtUrl" />
        <Grid Grid.Row="1">
                <ColumnDefinition Width="250"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            <ListBox Name="lstFeedItems"
                     DisplayMemberPath="Title.Text" />
            <GridSplitter Grid.Column="1"
            <Frame Name="frmContents"
                   Source="{Binding SelectedItem.Links[0].Uri, ElementName=lstFeedItems}"

The code-behind :

    private void btnGo_Click(object sender, RoutedEventArgs e)
        using (XmlReader reader = XmlReader.Create(txtUrl.Text))
            SyndicationFeed feed = SyndicationFeed.Load(reader);
            lstFeedItems.ItemsSource = feed.Items;

And here’s the result !


14 thoughts on “Build an RSS reader in 5 minutes”

    1. Hi karan,
      So basically you want me to do your work for you, for free… sorry, but that’s not going to happen. Now, if you have a specific question regarding this article, I’ll be glad to answer it if I can.

  1. Hi,

    In your example, we get the whole webpage, but I would like to be able to get title, description etc … separately to avoid loading the whole page and format as I want. Do you have any idea of how to proceed ?


    1. Hi,
      You can get the title and summary from the SyndicationItem, but depending on the feed, it might contain the full article or not… If you need the full article and the feed doesn’t contain it, you will need to scrape the website, and there’s no generic way of doing it since every site is different. You might also consider using a mobilizer like Instapaper or Readability.

  2. Hi,
    I have a similar rss reader code and in SyndicationFeed feed = SyndicationFeed.Load(reader); throws me a NotSupportedException. Do you have any idea why this happens and what to do to fix it? Sry for my English

    1. Hi,
      Sorry but I don’t have enough information to help you… you should post your question on Stackoverflow, where it’s easier to discuss your problem.

  3. which library does SyndicationFeed class refer. i tried using System.ServiceModel; its not working .

    1. It’s in the System.ServiceModel.Syndication namespace, in the System.ServiceModel assembly.

  4. Hi,

    I just tried this and wanted to say how great its is – good fun to play with and very useful – thanks for the article.



  5. Works nicely in UWP (although I had to NuGet System.ServiceModel.Syndication), just needed to change DockPanel to StackPanel, get rid of GridSplitter and change Frame to Webview. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *