XNamespace.Equality(XNamespace, XNamespace) Operator
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a value indicating whether two instances of XNamespace are equal.
public:
static bool operator ==(System::Xml::Linq::XNamespace ^ left, System::Xml::Linq::XNamespace ^ right);
public static bool operator == (System.Xml.Linq.XNamespace left, System.Xml.Linq.XNamespace right);
public static bool operator == (System.Xml.Linq.XNamespace? left, System.Xml.Linq.XNamespace? right);
static member ( = ) : System.Xml.Linq.XNamespace * System.Xml.Linq.XNamespace -> bool
Public Shared Operator == (left As XNamespace, right As XNamespace) As Boolean
Parameters
- left
- XNamespace
The first XNamespace to compare.
- right
- XNamespace
The second XNamespace to compare.
Returns
A Boolean that indicates whether left
and right
are equal.
Examples
The following example shows the comparison of an XNamespace and a string.
XNamespace aw = "http://www.adventure-works.com";
Console.WriteLine(aw == "http://www.adventure-works.com");
Imports <xmlns="http://www.adventure-works.com">
Module Module1
Sub Main()
Dim aw As XNamespace = GetXmlNamespace()
Console.WriteLine(aw = "http://www.adventure-works.com")
End Sub
End Module
This example produces the following output:
True
Remarks
The operator overloads ==
and !=
are provided to enable comparisons between XNamespace and string (for example, element.Name.Namespace == "http://www.adventure-works.com"
). The predefined reference equality operators in C# require one operand to be convertible to the type of the other through reference conversions only, and do not consider the implicit conversion from string to XNamespace.
Applies to
See also
.NET