public void ProjectionMethod2() { XDocument document = GetDocumentContext(); var AttributeElements = from element in document.Root.Elements() where element.HasAttributes == false select element; var ConfigElements = AttributeElements.Elements().Where(it => it.Name.LocalName == "ConfigImports"); var ConditionalElement = from ConfigElement in ConfigElements select ConfigElement.Attributes(); var Attributes1 = from attribute in ConditionalElement from names in attribute select names.Name.LocalName; }