Partager via


Enum.CompareTo(Object) Method

Definition

Compares this enum with the specified object for order.

[Android.Runtime.Register("compareTo", "(Ljava/lang/Enum;)I", "")]
public int CompareTo (Java.Lang.Object? o);
[<Android.Runtime.Register("compareTo", "(Ljava/lang/Enum;)I", "")>]
abstract member CompareTo : Java.Lang.Object -> int
override this.CompareTo : Java.Lang.Object -> int

Parameters

o
Object

Returns

Implements

Attributes

Remarks

Compares this enum with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Enum constants are only comparable to other enum constants of the same enum type. The natural order implemented by this method is the order in which the constants are declared.

Java documentation for java.lang.Enum.compareTo(E).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to