I have the following code
foreach (var rssItem in rss.Channel.Items)
{
// ...
}
But only want 6 items not all items, how can I do it in C#?
If you're interested in a condition (i.e. ordering by date created)
foreach(var rssItem in rss.Channel.Items.OrderByDescending(x=>x.CreateDate).Take(6))
{
//do something
}
Perhaps if you want to get those created by a certain user, with that same sort
foreach(var rssItem in rss.Channel.Items
.Where(x=>x.UserID == 1)
.OrderByDescending(x=>x.CreateDate)
.Take(6))
{
//do something
}