I've got the code below which queries an RSS feed which works fine but I've just come across a feed in which the pubDate element is optional and doesn't occur in all items.
What do I need to do to make this optional in the code below in both the Order By and Select. I've done some Googling but can't find how to do this.
Dim rssFeed As XDocument = XDocument.Load(strURL)
Dim items = From item In rssFeed.Descendants("channel").Descendants("item") _
Order By CType(item.Element("pubDate").Value, DateTime) Descending _
Select title = item.Element("title").Value, _
link = item.Element("link").Value, _
description = item.Element("description").Value, _
publishedDate = item.Element("pubDate").Value