Quantcast
Channel: User jkade - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Answer by jkade for Reading non-standard elements in a SyndicationItem with SyndicationFeed

$
0
0

Whether you're retrieving the non-XML contents of extension elements or XElement items, you might want to consider using a generic helper function like:

private static T GetExtensionElementValue<T>(SyndicationItem item, string extensionElementName){       return item.ElementExtensions.First(ee => ee.OuterName == extensionElementName).GetObject<T>();}

Depending on whether the elements are guaranteed to be there or whether you are putting this into a reusable library, you may need to add additional defensive programming.


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>