Skip to content

Instantly share code, notes, and snippets.

@ChuckSavage
Created July 20, 2012 17:58
Show Gist options
  • Save ChuckSavage/3152271 to your computer and use it in GitHub Desktop.
Save ChuckSavage/3152271 to your computer and use it in GitHub Desktop.
[DebuggerDisplay("{Title}, Desc({Description}), Link({Link})")]
public class Item
{
public Item(XElement x)
{
Title = x.Element("title").Value;
Description = x.Element("description").Value;
XElement link = x.Element("link");
if(null != link)
Link = link.Value;
XElement cc = x.Element("channelContents");
if (null != cc)
Items = cc.Elements("item").Select(c => new Item(c)).ToArray();
}
public string Title;
public string Description;
public string Link;
public Item[] Items;
}
// You fill it using:
Items[] items = XElement.Load(file).Elements("item").Select(i => new Item(i)).ToArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment