System.Uri.Equals Method

Compares two Uri instances for equality.

Syntax

public override bool Equals (object comparand)

Parameters

comparand
The Uri instance or a URI identifier to compare with the current instance.

Returns

A bool value that is true if the two instances represent the same URI; otherwise, false.

Remarks

The Uri.Equals(object) method compares the two instances without regard to user information (Uri.UserInfo) and fragment (Uri.Fragment) parts that they might contain. For example, given the URIs http://www.contoso.com/index.htm#search and http://user:password@www.contoso.com/index.htm, the Uri.Equals(object) method would return true.

If one Uri instance is formed with a Unicode host name and comparand parameter contains a Uri instance or identifier that is formed with a host name that has the equivalent Punycode host name, then Uri.Equals(object) returns true only if International Resource Identifier (IRI) and Internationalized Domain Name (IDN) support are enabled. Punycode names contain only ASCII characters and always start with the xn-- prefix.

For more information on IRI support, see the Remarks section for the Uri class.

Note:

In the .NET Framework versions 1.0 and 1.1, the Uri.Query is also ignored.

Note:

The Uri.Equals(object) method can be overridden in a derived class; use caution as a malicious entity could modify the method. You should not use this method to perform security checks unless you know that this instance came from a trusted source.

Requirements

Namespace: System
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0