You just need to make another request inside your request. For example, if an element channelcontains itemelements, you can do:
Items = feed.Elements("item")
.Select(x => new Item {
.ToArray()
Update. It seems you are reading the file RSS, so your request should look something like this:
var data = from feed in feedXml.Descendants("channel")
select new Rss
{
Title = (string) feed.Element("title"),
Link = (string) feed.Element("link"),
Description = (string) feed.Element("description"),
Items = feed.Elements("item")
.Select(
x =>
new Item
{
Title = (string) x.Element("title"),
Link = (string) x.Element("link"),
Description = (string) x.Element("description"),
Guid = (string) x.Element("guid"),
PublishDate = (DateTime) x.Element("pubDate")
})
.ToArray()
};
I also used an explicit conversion instead of trying to access a property Valueto prevent NullReferenceException.
source
share