Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Uri.Compare Method

Note: This method is new in the .NET Framework version 2.0.

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

Namespace: System
Assembly: System (in system.dll)

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
)
public static function Compare (
	uri1 : Uri, 
	uri2 : Uri, 
	partsToCompare : UriComponents, 
	compareFormat : UriFormat, 
	comparisonType : StringComparison
) : int

Parameters

uri1

The first Uri.

uri2

The second Uri.

partsToCompare

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

compareFormat

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

comparisonType

One of the StringComparison values.

Return Value

A 32-bit signed integer indicating 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.

Exception typeCondition

ArgumentException

comparisonType is not a valid StringComparison value.

If both uri1 and uri2 are a null reference (Nothing in Visual Basic), this method returns0. 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 a null reference (Nothing in Visual Basic) and are both relative URIs or both absolute URIs, the String.Compare(String,String,StringComparison) method performs the comparison.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft