Posted on: 4/27/2015 3:19:34 PM | Views : 607

What is the best way to handle an error like below when I am doing a .First() on a Linq XML statement?
System.InvalidOperationException: Sequence contains no elements at System.Linq.Enumerable.First[TSource](IEnumerable`1 source) I am pulling information based on span tags and classes and then getting attribute values etc. 
Can I just move it from .First() to .FirstOrDefault() and return a null and then check for null or is there a better way to handle this?

Go to the complete details ...