Uri.Compare(Uri, Uri, UriComponents, UriFormat, StringComparison) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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);
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
- uri1
- Uri
The first URI.
- uri2
- Uri
The second URI.
- partsToCompare
- UriComponents
A bitwise combination of the UriComponents values that specifies the parts of uri1
and uri2
to compare.
- compareFormat
- UriFormat
One of the enumeration values that specifies the character escaping used when the URI components are compared.
- comparisonType
- StringComparison
One of the enumeration values that specifies the culture, case, and sort rules for the comparison.
A 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 .
|
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.
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |