Array.IStructuralComparable.CompareTo(Object, IComparer) Method

Definition

判斷目前的集合物件在排序次序中位於另一個物件之前、相同位置或之後。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);
abstract member System.Collections.IStructuralComparable.CompareTo : obj * System.Collections.IComparer -> int
override this.System.Collections.IStructuralComparable.CompareTo : obj * System.Collections.IComparer -> int
Function CompareTo (other As Object, comparer As IComparer) As Integer Implements IStructuralComparable.CompareTo

Parameters

other
Object

要與目前執行個體比較的物件。The object to compare with the current instance.

comparer
IComparer

將目前的物件與 other 相比較的物件。An object that compares the current object and other.

Returns

Int32

整數,表示目前集合物件與 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.

Implements

Remarks

這個成員是明確的介面成員實作。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.

Applies to