PackUriHelper.ComparePartUri(Uri, Uri) Method

Definition

Returns a value that indicates whether two package part URIs are equivalent.

C#
public static int ComparePartUri(Uri? firstPartUri, Uri? secondPartUri);
C#
public static int ComparePartUri(Uri firstPartUri, Uri secondPartUri);

Parameters

firstPartUri
Uri

The URI of the first PackagePart.

secondPartUri
Uri

The URI of the second PackagePart.

Returns

A value that indicates the relationship between firstPartUri and secondPartUri.

Value Meaning
Less than 0 firstPartUri is less than secondPartUri.
0 firstPartUri is equivalent to secondPartUri.
Greater than 0 firstPartUri is greater than secondPartUri.

Exceptions

firstPartUri or secondPartUri is not a valid part URI syntax.

Remarks

If both firstPartUri and secondPartUri are null, ComparePartUri returns 0. When comparing PackagePart URIs, a null URI is always less than a non-null URI. For cases where firstPartUri and secondPartUri are both relative PackagePart URIs, ComparePartUri performs the comparison.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 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 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also