I have the following scenario:
if(xml.Descendants(ns + "Children").FirstOrDefault() != null)
{
XElement children = xml.Descendants(ns + "Children").FirstOrDefault();
}
Is there a way I can check for null and assign the value at the same time instead of having to search for the value twice, something similar to:
//Not sure if this is correct.
if (XElement children = xml.Descendants(ns + "Children").FirstOrDefault() != null)
{
}