ValueTuple<T1,T2>.IStructuralComparable.CompareTo(Object, IComparer) ValueTuple<T1,T2>.IStructuralComparable.CompareTo(Object, IComparer) ValueTuple<T1,T2>.IStructuralComparable.CompareTo(Object, IComparer) Method

定义

使用指定的比较器比较当前 ValueTuple<T1,T2> 实例与指定对象,并返回一个整数,该整数指示当前对象在排序顺序中的位置:是在指定对象之前、之后还是在与指定对象相同的位置。Compares the current ValueTuple<T1,T2> instance to a specified object by using a specified comparer and returns an integer that indicates whether the current object is before, after, or in the same position as the specified 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

提供用于比较的自定义规则的对象。An object that provides custom rules for comparison.

返回

一个带符号整数,指示此实例和 other 在排序顺序中的相对位置,如下表所示。A signed integer that indicates the relative position of this instance and other in the sort order, as shown in the following table.

Value 说明Description
负整数A negative integer 此实例位于 other 之前。This instance precedes other.
Zero 此实例在排序顺序中的位置与 other 相同。This instance and other have the same position in the sort order.
正整数A positive integer 此实例位于 other 之后。This instance follows other.

实现

适用于