Created
December 19, 2012 22:42
-
-
Save sandrinodimattia/4341246 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class BlogReader | |
{ | |
public static IEnumerable<Model.BlogPost> Read() | |
{ | |
using (var rdr = System.Xml.XmlReader.Create("http://blogs.msdn.com/b/windowsazure/rss.aspx")) | |
{ | |
foreach (var item in SyndicationFeed.Load(rdr).Items) | |
{ | |
yield return new Model.BlogPost() | |
{ | |
Author = item.ElementExtensions.FirstOrDefault(o => o.OuterName == "creator").GetObject<string>(), | |
PublishedOn = item.PublishDate.UtcDateTime, | |
Title = item.Title.Text | |
}; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment