Pretty straight-forward, but a useful snippet of code nonetheless.
Given this class:
public class AggregateContent
{
public string Title { get; set; }
public string Description { get; set; }
public AggregateContent(string Header, string Content)
{
Title = Header;
Description = Content;
}
}
You can use line to create an IEnumerable<AggregateContent> like this:
IEnumerable<AggregateContent> a =
LastNNewsItems.Select(p => new AggregateContent(p.NewsTitle, p.HtmlContent));
Technorati Tags:
quick-tip