Array.IStructuralComparable.CompareTo(Object, IComparer) Array.IStructuralComparable.CompareTo(Object, IComparer) Array.IStructuralComparable.CompareTo(Object, IComparer) Method

定義

判斷目前的集合物件在排序次序中位於另一個物件之前、相同位置或之後。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 Object Object

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

comparer
IComparer IComparer IComparer

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

傳回

整數,表示目前集合物件與 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 目前的執行個體之前otherThe current instance precedes other.
00 目前的執行個體和other相等。The current instance and other are equal.
11 目前的執行個體otherThe 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.

適用於