Uredi

Deli z drugimi prek


XNamespace.Inequality(XNamespace, XNamespace) Operator

Definition

Returns a value indicating whether two instances of XNamespace are not 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 op_Inequality : 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 not equal.

Examples

The following example shows a comparison of a XNamespace to 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:

False

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