With this method I search all the items in a url. Now I need to select only the item from the fifth position, how can I do this and what changes should I make?
private async Task<List<FeedItem>> ParseFeed(string rss)
{
return await Task.Run(() =>
{
var xdoc = XDocument.Parse(rss);
var id = 0;
return (from item in xdoc.Descendants("item")
let enclosure = item.Element("enclosure")
where enclosure != null
select new FeedItem
{
Title = (string)item.Element("title"),
Description = (string)item.Element("description"),
Link = (string)item.Element("link"),
PublishDate = DateTime.Parse((string)item.Element("pubDate")).ToUniversalTime().ToString("dd/MM/yyyy HH:mm:ss"),
Category = (string)item.Element("category"),
Mp3Url = (string)enclosure.Attribute("url"),
Image = (string)enclosure.Attribute("url"),
Color_category =Convert.ToString(int.Parse((string)item.Element("color")), 16).PadLeft(6, '0'),
Id = id++
}).ToList();
});
}