Export (0) Print
Expand All

Uri.Compare Method

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
)

Parameters

uri1
Type: System.Uri
The first Uri.
uri2
Type: System.Uri
The second Uri.
partsToCompare
Type: System.UriComponents
A bitwise combination of the UriComponents values that specifies the parts of uri1 and uri2 to compare.
compareFormat
Type: System.UriFormat
One of the UriFormat values that specifies the character escaping used when the URI components are compared.
comparisonType
Type: System.StringComparison
One of the StringComparison values.

Return Value

Type: System.Int32
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.

ExceptionCondition
ArgumentException

comparisonType is not a valid StringComparison value.

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.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2014 Microsoft