共用方式為


PSObject.CompareTo(Object) Method

Definition

Compares the current instance with another object of the same type.

public:
 virtual int CompareTo(System::Object ^ obj);
public:
 int CompareTo(Platform::Object ^ obj);
int CompareTo(winrt::Windows::Foundation::IInspectable const & obj);
public int CompareTo (object obj);
abstract member CompareTo : obj -> int
override this.CompareTo : obj -> int
Public Function CompareTo (obj As Object) As Integer

Parameters

obj
Object

An object to compare with this instance.

Returns

A 32-bit signed integer that indicates the relative order of the comparands. The return value has these meanings: Value Meaning Less than zero This instance is less than obj. Zero This instance is equal to obj. Greater than zero This instance is greater than obj.

Implements

Exceptions

If obj has a different type than this instance's BaseObject or if the BaseObject does not implement IComparable.

Applies to