2 instantiations of XNamespace
System.Private.Xml.Linq (2)
169 references to XNamespace
BuildBoss (4)
dotnet-svcutil-lib (4)
IIS.FunctionalTests (2)
IISExpress.FunctionalTests (2)
Microsoft.AspNetCore.DataProtection (2)
Microsoft.AspNetCore.DataProtection.Tests (1)
Microsoft.Build.BuildCheck.UnitTests (1)
Microsoft.Build.CommandLine.UnitTests (1)
Microsoft.Build.Engine.OM.UnitTests (1)
Microsoft.Build.Engine.UnitTests (1)
Microsoft.Build.Framework.UnitTests (1)
Microsoft.Build.Tasks.Core (4)
Microsoft.Build.Tasks.UnitTests (1)
Microsoft.Build.Utilities.UnitTests (1)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.Build.Tasks.Packaging (1)
Microsoft.DotNet.Build.Tasks.Workloads (2)
Microsoft.DotNet.PackageTesting (1)
Microsoft.DotNet.SharedFramework.Sdk (1)
Microsoft.DotNet.XliffTasks (5)
Microsoft.Maui.Resizetizer (5)
Microsoft.VisualStudio.LanguageServices (1)
netstandard (1)
System.Private.Xml.Linq (123)
System\Xml\Linq\XLinq.cs (22)
183private XNamespace _ns;
186public XNamespace Get(string namespaceName)
190_ns = XNamespace.Get(namespaceName);
295private string? GetPrefixOfNamespace(XNamespace ns, bool allowDefaultNamespace)
301if ((object)namespaceName == (object)XNamespace.xmlPrefixNamespace) return "xml";
302if ((object)namespaceName == (object)XNamespace.xmlnsPrefixNamespace) return "xmlns";
320_resolver.AddFirst(a.Name.NamespaceName.Length == 0 ? string.Empty : a.Name.LocalName, XNamespace.Get(a.Value));
338_resolver.Add(a.Name.NamespaceName.Length == 0 ? string.Empty : a.Name.LocalName, XNamespace.Get(a.Value));
373XNamespace ns = e.Name.Namespace;
384_writer.WriteAttributeString(GetPrefixOfNamespace(ns, false), localName, namespaceName.Length == 0 && localName == "xmlns" ? XNamespace.xmlnsPrefixNamespace : namespaceName, a.Value);
392XNamespace ns = e.Name.Namespace;
404await _writer.WriteAttributeStringAsync(GetPrefixOfNamespace(ns, false), localName, namespaceName.Length == 0 && localName == "xmlns" ? XNamespace.xmlnsPrefixNamespace : namespaceName, a.Value).ConfigureAwait(false);
415public XNamespace ns = null!;
452public void Add(string prefix, XNamespace ns)
470public void AddFirst(string prefix, XNamespace ns)
491public string? GetPrefixOfNamespace(XNamespace ns, bool allowDefaultNamespace)
546XNamespace ns = _element.Name.Namespace;
553_writer.WriteAttributeString(GetPrefixOfNamespace(ns, false), localName, namespaceName.Length == 0 && localName == "xmlns" ? XNamespace.xmlnsPrefixNamespace : namespaceName, a.Value);
560private string? GetPrefixOfNamespace(XNamespace ns, bool allowDefaultNamespace)
566if ((object)namespaceName == (object)XNamespace.xmlPrefixNamespace) return "xml";
567if ((object)namespaceName == (object)XNamespace.xmlnsPrefixNamespace) return "xmlns";
578_resolver.Add(a.Name.NamespaceName.Length == 0 ? string.Empty : a.Name.LocalName, XNamespace.Get(a.Value));
System\Xml\Linq\XNamespace.cs (54)
19private static XHashtable<WeakReference<XNamespace>>? s_namespaces;
20private static WeakReference<XNamespace>? s_refNone;
21private static WeakReference<XNamespace>? s_refXml;
22private static WeakReference<XNamespace>? s_refXmlns;
64/// Returns the namespace name of this <see cref="XNamespace"/>.
73/// Gets the <see cref="XNamespace"/> object that corresponds to no namespace.
79public static XNamespace None
88/// Gets the <see cref="XNamespace"/> object that corresponds to the xml uri (http://www.w3.org/XML/1998/namespace).
90public static XNamespace Xml
99/// Gets the <see cref="XNamespace"/> object that corresponds to the xmlns uri (http://www.w3.org/2000/xmlns/).
101public static XNamespace Xmlns
110/// Gets an <see cref="XNamespace"/> created from the specified namespace name.
113/// The returned <see cref="XNamespace"/> object is guaranteed to be atomic
116public static XNamespace Get(string namespaceName)
124/// Converts a string containing a namespace name to an <see cref="XNamespace"/>.
127/// <returns>An <see cref="XNamespace"/> constructed from the namespace name string.</returns>
130public static implicit operator XNamespace?(string? namespaceName)
136/// Combines an <see cref="XNamespace"/> object with a local name to create an <see cref="XName"/>.
141public static XName operator +(XNamespace ns, string localName)
149/// Determines whether the specified <see cref="XNamespace"/> is equal to the current <see cref="XNamespace"/>.
151/// <param name="obj">The <see cref="XNamespace"/> to compare to the current <see cref="XNamespace"/>.</param>
153/// true if the specified <see cref="XNamespace"/> is equal to the current <see cref="XNamespace"/>; otherwise false.
156/// For two <see cref="XNamespace"/> objects to be equal they must have the same
165/// Serves as a hash function for <see cref="XNamespace"/>. GetHashCode is suitable
181/// Returns a value indicating whether two instances of <see cref="XNamespace"/> are equal.
183/// <param name="left">The first <see cref="XNamespace"/> to compare.</param>
184/// <param name="right">The second <see cref="XNamespace"/> to compare.</param>
188/// an instance of <see cref="XNamespace"/> and string.
190public static bool operator ==(XNamespace? left, XNamespace? right)
196/// Returns a value indicating whether two instances of <see cref="XNamespace"/> are not equal.
198/// <param name="left">The first <see cref="XNamespace"/> to compare.</param>
199/// <param name="right">The second <see cref="XNamespace"/> to compare.</param>
203/// an instance of <see cref="XNamespace"/> and string.
205public static bool operator !=(XNamespace? left, XNamespace? right)
230/// Returns an <see cref="XNamespace"/> created from a portion of the passed in namespace name parameter. The returned <see cref="XNamespace"/>
233internal static XNamespace Get(string namespaceName, int index, int count)
242Interlocked.CompareExchange(ref s_namespaces, new XHashtable<WeakReference<XNamespace>>(ExtractNamespace, NamespacesCapacity), null);
244WeakReference<XNamespace>? refNamespace;
245XNamespace? ns;
258refNamespace = s_namespaces.Add(new WeakReference<XNamespace>(new XNamespace(namespaceName.Substring(index, count))));
261ns = refNamespace != null && refNamespace.TryGetTarget(out XNamespace? target) ? target : null;
282private static string? ExtractNamespace(WeakReference<XNamespace>? r) =>
284r.TryGetTarget(out XNamespace? target) ? target.NamespaceName : null;
292private static XNamespace EnsureNamespace(ref WeakReference<XNamespace>? refNmsp, string namespaceName)
294WeakReference<XNamespace>? refOld;
302if (refOld != null && refOld.TryGetTarget(out XNamespace? ns))
310Interlocked.CompareExchange(ref refNmsp, new WeakReference<XNamespace>(new XNamespace(namespaceName)), refOld);
System.Xml.Linq (1)
System.Xml.XDocument (1)