Char.IComparable.CompareTo(Object) 方法

定義

將目前的執行個體與相同類型的另一個物件相比較,並傳回整數,這個整數表示目前的執行個體在排序次序中,位於另一個物件之前、之後或相同位置。Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

 virtual int System.IComparable.CompareTo(System::Object ^ value) = IComparable::CompareTo;
int IComparable.CompareTo (object value);
abstract member System.IComparable.CompareTo : obj -> int
override this.System.IComparable.CompareTo : obj -> int
Function CompareTo (value As Object) As Integer Implements IComparable.CompareTo

參數

value
Object

要比較的物件。The object to compare.

傳回

Int32

值,表示所比較之物件的相對順序。A value that indicates the relative order of the objects being compared.

實作

備註

這個成員是明確介面成員實作,This member is an explicit interface member implementation. 只有在 Char 執行個體轉換成 IComparable 介面時,才能使用這個成員。It can be used only when the Char instance is cast to an IComparable interface.

Value 意義Meaning
小於零Less than zero 這個執行個體在排序次序中會在 value 之前。This instance precedes value in the sort order.
Zero 這個執行個體在排序次序中的位置和 value 相同。This instance occurs in the same position in the sort order as value.
大於零Greater than zero 這個執行個體在排序順序中會跟在 value 之後。This instance follows value in the sort order.

適用於