Uri.Compare(Uri, Uri, UriComponents, UriFormat, StringComparison) Uri.Compare(Uri, Uri, UriComponents, UriFormat, StringComparison) Uri.Compare(Uri, Uri, UriComponents, UriFormat, StringComparison) Uri.Compare(Uri, Uri, UriComponents, UriFormat, StringComparison) Method

Definition

Compares the specified parts of two URIs using the specified comparison rules.

public:
 static int Compare(Uri ^ uri1, Uri ^ uri2, UriComponents partsToCompare, UriFormat compareFormat, StringComparison comparisonType);
public static int Compare (Uri uri1, Uri uri2, UriComponents partsToCompare, UriFormat compareFormat, StringComparison comparisonType);
static member Compare : Uri * Uri * UriComponents * UriFormat * StringComparison -> int
Public Shared Function Compare (uri1 As Uri, uri2 As Uri, partsToCompare As UriComponents, compareFormat As UriFormat, comparisonType As StringComparison) As Integer

Parameters

uri1
Uri Uri Uri Uri

The first Uri.

uri2
Uri Uri Uri Uri

The second Uri.

partsToCompare
UriComponents UriComponents UriComponents UriComponents

A bitwise combination of the UriComponents values that specifies the parts of uri1 and uri2 to compare.

compareFormat
UriFormat UriFormat UriFormat UriFormat

One of the UriFormat values that specifies the character escaping used when the URI components are compared.

Returns

An Int32 value that indicates the lexical relationship between the compared Uri components.

Value Meaning
Less than zero uri1 is less than uri2.
Zero uri1 equals uri2.
Greater than zero uri1 is greater than uri2.

Exceptions

Remarks

If both uri1 and uri2 are null, this method returns 0. When comparing URI values, a relative URI is always less than an absolute URI, and a non-null URI is always greater than a null URI. For cases where both uri1 and uri2 are not null and are both relative URIs or both absolute URIs, the String.Compare(String, String, StringComparison) method performs the comparison.

Applies to