I'm designing a small system to parse RSS feeds, and I have two classes: Feed and FeedItem.
public class Feed
{
public string Title{ get; set; }
public string Link{ get; set; }
public string Description { get; set; }
public bool IsTwitterFeed { get; set; }
public List<FeedItem> Items { get; set; }
}
public class FeedItem
{
public string Title { get; set; }
public string Link{ get; set; }
public string Description { get; set; }
public DateTime Date { get; set; }
}
Feeds have FeedItems, and FeedItems have parent Feeds. Would it be a bad pattern to give the FeedItem class a parent Feed member:
public Feed ParentFeed { get; set; }
so I could do this:
// get the latest item from the latest feed, then print its parent feed name
FeedItem item = Feeds.GetLatest().Item[0];
Response.Write(item.ParentFeed.Name + ": " + item.Title);
or should I only ever get a FeedItem through its parent Feed, to avoid this circular reference between these two classes?