src/Misc/PowerTools/Extensions/XContainerExtensions.cs
// <summary>
// Gets the first (in document order) child element with the specified local name and one of the namespaces.
// </summary>
// <param name="container">The node containing the child elements.</param>
// <param name="namespaces">A collection of namespaces used when searching for the child element.</param>
// <param name="localName">The local (unqualified) name to match.</param>
// <returns>A <see cref="XElement" /> that matches the specified name and namespace, or null.</returns>
Gets the first (in document order) child element with the specified local name and one of the namespaces.
Gets the first ( in document order ) child element with the specified local name and one of the namespaces .
public static XElement Element(this XContainer container, IEnumerable<XNamespace> namespaces, string localName)
        {
            DebugCheck.NotNull(container);
            DebugCheck.NotNull(namespaces);
            DebugCheck.NotEmpty(localName);
            return container.Elements()
                .FirstOrDefault(
                    e => e.Name.LocalName == localName
                        && namespaces.Contains(e.Name.Namespace));
        }
public static XElement Element ( this XContainer container , IEnumerable < XNamespace > namespaces , string localName ) { DebugCheck . NotNull ( container ) ; DebugCheck . NotNull ( namespaces ) ; DebugCheck . NotEmpty ( localName ) ; return container . Elements ( ) . FirstOrDefault ( e => e . Name . LocalName == localName && namespaces . Contains ( e . Name . Namespace ) ) ; }
Gets the first (in document order) child element with the specified local name and one of the namespaces.
Gets the first ( in document order ) child element with the specified local name and one of the namespaces .
A  that matches the specified name and namespace, or null.
A that matches the specified name and namespace or null .
XContainer
this
namespaces
IEnumerable<XNamespace>
A collection of namespaces used when searching for the child element.
A collection of namespaces used when searching for the child element .
localName
string
The local (unqualified) name to match.
The local ( unqualified ) name to match .
container
The node containing the child elements.
The node containing the child elements .