Array.IStructuralComparable.CompareTo(Object, IComparer) 方法

定义

确定当前集合对象在排序顺序中的位置是位于另一个对象之前、之后还是与其位置相同。

C#
int IStructuralComparable.CompareTo (object other, System.Collections.IComparer comparer);

参数

other
Object

要与当前实例进行比较的对象。

comparer
IComparer

一个将当前对象与 other 进行比较的对象。

返回

Int32

一个指示当前集合对象与其他对象的关系的整数,如下表所示。

返回值 说明
-1 当前实例位于 other 之前。
0 当前实例与 other 位于同一位置。
1 当前实例位于 other 之后。

实现

注解

此成员是显式接口成员的实现。 它只能在 Array 实例被强制转换为 IStructuralComparable 接口时使用。

适用于

产品 版本
.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
.NET Framework 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
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0