XNamespace.Equals(Object) 方法

定义

确定指定的 XNamespace 是否等于当前 XNamespaceDetermines whether the specified XNamespace is equal to the current XNamespace.

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

参数

obj
Object

要与当前 XNamespace 进行比较的 XNamespaceThe XNamespace to compare to the current XNamespace.

返回

指示指定 Boolean 是否等于当前 XNamespaceXNamespaceA Boolean that indicates whether the specified XNamespace is equal to the current XNamespace.

示例

下面的示例比较引用同一 URI 的两个命名空间。The following example compares two namespaces that refer to the same URI.

XNamespace aw = "http://www.adventure-works.com";  
Console.WriteLine(aw == "http://www.adventure-works.com");  
Imports <xmlns:aw="http://www.adventure-works.com">  
  
Module Module1  
    Sub Main()  
        Console.WriteLine(GetXmlNamespace(aw) = "http://www.adventure-works.com")  
    End Sub  
End Module  

此示例生成以下输出:This example produces the following output:

True  

注解

对于两个 XNamespace 对象相等,它们必须具有相同的 URI。For two XNamespace objects to be equal, they must have the same URI.

适用于

另请参阅