public static XElement DescendantElement(this XContainer node, params string[] names) { var cur = node; for (int i = 0; i < names.Length; i++) { cur = node.ChildElement(names[i]); if (cur == null) { return(null); } } return(cur as XElement); }