My current project (C# 3.5) has a lot of code like this (elem is an instance of XElement):
textbox1.Text = elem.Element("TagName") == null ? "" : elem.Element("TagName").Value;
Is there any way to write the same thing without repeating a call elem.Element() and without use of extension methods? Maybe using lambdas? (But I cannot figure out how.)
ElementHelper.ValueOrDefault(elem, "TagName", "")
. – Oruro