Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Method

Equals

virtual func Equals(other: object?) -> bool

Declaring type: Object
Module: System
Assembly: System.Runtime.dll
Source file: Object.rvn

Tests reference identity by default; an ordinary class may override equality.

Parameters

Name Type Description
other Object? The object to compare with this instance, or null.

Return value

Boolean

For the default class/array implementation, true only when other aliases this instance. An override supplies its own equality policy.

Remarks

The other parameter is nullable for Raven compatibility: Equals(Object? other). Null other returns false for a supported non-null default receiver. A null receiver raises NullReference. Class overrides must be consistent with GetHashCode: equal objects must have equal hashes. Virtual calls on boxed Int32, Int64, Boolean, Single, Double or Char compare copied values only with the same concrete type; null or another concrete type compares false. Boolean true does not equal Int32 one. Single and Double require the same concrete type: all NaNs of that type compare equal, and positive and negative zero compare equal. Floating operators retain IEEE comparisons. Char compares its complete grapheme text exactly, without normalization. Boxed named structs dispatch explicit Equals overrides; record structs generate exact-type component equality. String through Object compares exact contents with another String wrapper, rejecting null and other types. No normalization or culture rules are applied. Other boxed primitives remain unsupported. Explicit Object base calls retain reference equality. This does not add structural class equality or change EquatableTo contracts.