XDocumentExtensions.

GetXNameWithNamespace(XNamespace, string) Method

Summary

Combines an XNamespace with an element name into an XName, handling the case where the namespace is null (pre-VS2017 csproj files use a default namespace; modern SDK-style projects don't).

Syntax

public static XName GetXNameWithNamespace(this XNamespace ns, string elementName)

Parameters

Name Type Description
ns XNamespace the namespace (or null)
elementName string the element name

Return Value

Type Description
XName an XName scoped to the namespace when provided