Array.IStructuralComparable.CompareTo(Object, IComparer) 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定当前集合对象在排序顺序中的位置是位于另一个对象之前、之后还是与其位置相同。
virtual int System.Collections.IStructuralComparable.CompareTo(System::Object ^ other, System::Collections::IComparer ^ comparer) = System::Collections::IStructuralComparable::CompareTo;
C#
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
- other
- Object
要与当前实例进行比较的对象。
- comparer
- IComparer
一个将当前对象与 other
进行比较的对象。
一个指示当前集合对象与其他对象的关系的整数,如下表所示。
返回值 | 说明 |
---|---|
-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 |