Performs a null safe comparison using "==" instead of Object.Equals()

Namespace: NHibernate
Assembly: NHibernate (in NHibernate.dll) Version: 3.2.0.4000 (3.2.0.4000)

Syntax

C#
public bool Equals(
	Object x,
	Object y
)
Visual Basic
Public Function Equals ( _
	x As Object, _
	y As Object _
) As Boolean
Visual C++
public:
virtual bool Equals(
	Object^ x, 
	Object^ y
) sealed

Parameters

x
Type: System..::..Object
First object to compare.
y
Type: System..::..Object
Second object to compare.

Return Value

true if x is the same instance as y or if both are null references; otherwise, false.

Implements

IEqualityComparer..::..Equals(Object, Object)

Remarks

This is Lazy collection safe since it uses ReferenceEquals(Object, Object), unlike Object.Equals() which currently causes NHibernate to load up the collection. This behaivior of Collections is likely to change because Java's collections override Equals() and .net's collections don't. So in .net there is no need to override Equals() and GetHashCode() on the NHibernate Collection implementations.

See Also