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

定义

确定当前集合对象在排序顺序中的位置是位于另一个对象之前、之后还是与其位置相同。Determines whether the current collection object precedes, occurs in the same position as, or follows another object in the sort order.

 virtual int System.Collections.IStructuralComparable.CompareTo(System::Object ^ other, System::Collections::IComparer ^ comparer) = System::Collections::IStructuralComparable::CompareTo;
int IStructuralComparable.CompareTo (object other, System.Collections.IComparer comparer);
Function CompareTo (other As Object, comparer As IComparer) As Integer Implements IStructuralComparable.CompareTo

参数

other
Object

要与当前实例比较的对象。The object to compare with the current instance.

comparer
IComparer

一个将当前对象与 other 进行比较的对象。An object that compares the current object and other.

返回

一个指示当前集合对象与其他对象的关系的整数,如下表所示。An integer that indicates the relationship of the current collection object to other, as shown in the following table.

返回值Return value 说明Description
-1-1 当前实例位于 other 之前。The current instance precedes other.
00 当前实例与 other 位于同一位置。The current instance and other are equal.
11 当前实例位于 other 之后。The current instance follows other.

实现

注解

此成员是显式接口成员实现。This member is an explicit interface member implementation. 它只能在 Array 实例被强制转换为 IStructuralComparable 接口时使用。It can be used only when the Array instance is cast to an IStructuralComparable interface.

适用于