I have this peace of code. I have to check each level in XML avoiding NULL exception. Can I improve this code?
private void GetFunctionsValues(XElement x)
{
if (x.Element("credentials") != null)
{
if (x.Element("credentials").Element("faccess") != null)
{
foreach (var access in x.Element("credentials").Element("faccess").Elements("access"))
{
if (access.Attribute("db_id") != null)
{
if (int.Parse(access.Attribute("db_id").Value) == 19) FuncPlus = true;
}
}
}
}
}