The situation I am faced with is parsing an XML document into an object using Linq. During the parse I am checking to make sure Elements are not null before proceeding to p
You can replace
x.Element("nodeName") != null : int.Parse(x.Element("nodeName").Value) : 0
with
(int)x.Element("nodeName")
It works for string, int, double, decimal, bool, uint, DateTime and Nullable of those as well.
string
int
double
decimal
bool
uint
DateTime
Nullable