Update February 11th. The class now updates every feed in the cache asynchronously and automatically.

On the login screen of Headlight, we are soon adding news updates so that our customers can see what is going on with the product. The content is delivered from our company blog via RSS and we are probably going to use FeedBurner’s JavaScript to display the latest items. Then I started thinking about how easy it would be to write a simple RSS feed parser in C# instead.

It should support caching so it doesn’t parse the feed at every page request. I know there are some very good RSS libraries such as RSS.NET, but I wanted to build it myself. Now it is one hour later and this is the result.

Examples of use

By using the Create method of the RssReader class, you specify a TimeSpan of when the feed should expire from the cache. In this example it expires after two hours. Remember not to dispose or use the "using" claus when you use the CreateAndCache method. Otherwise you dispose the cached instance.