IComparable<T>

Overview

Comparer interface; compares a value to another value of the same type.

Location

Implemented in

Required Methods


constructor    (declared in Object)

Default constructor.

 

constructor

 

IComparable<T>()

 

init()

 

IComparable<T>()

CompareTo

Compare a value to another value of the same type; should return 0 if equal, 1 if more, -1 if less.

 

method CompareTo(a: T): Int32

 

Int32 CompareTo(T a)

 

func CompareTo(_ a: T) -> Int32

 

Int32 CompareTo(T a)

Parameters:

  • a:

Equals  virtual    (declared in Object)

Returns true if the target object matches this one, by default compares the reference.

 

method Equals(obj: Object): Boolean

 

Boolean Equals(Object obj)

 

func Equals(_ obj: Object) -> Boolean

 

Boolean Equals(Object obj)

Parameters:

  • obj: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

Finalizer implementation. If not overriden it's not called at all, the runtime checks if there is an override before calling a finalizer.

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

GetHashCode  virtual    (declared in Object)

Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

ToString  virtual    (declared in Object)

Gets the string representation of this method.

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

ReferenceEquals    (declared in Object)

Compares two references for equivalence (even if they have an equals operator)

 

class method ReferenceEquals(a: Object; b: Object): Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

 

static func ReferenceEquals(_ a: Object, _ b: Object) -> Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

Parameters:

  • a: left value
  • b: right value