Compartilhar via


EqualityComparer<T>.IEqualityComparer.Equals Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Determines whether the specified objects are equal.

Namespace:  System.Collections.Generic
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Private Function Equals ( _
    x As Object, _
    y As Object _
) As Boolean Implements IEqualityComparer.Equals
bool IEqualityComparer.Equals(
    Object x,
    Object y
)

Parameters

Return Value

Type: System.Boolean
true if the specified objects are equal; otherwise, false.

Implements

IEqualityComparer.Equals(Object, Object)

Exceptions

Exception Condition
ArgumentException

x or y is of a type that cannot be cast to type T.

Remarks

This method is a wrapper for the Equals(T, T) method, so obj must be cast to the type specified by the generic argument T of the current instance. If it cannot be cast to T, an ArgumentException is thrown.

Comparing nulla null reference (Nothing in Visual Basic) is allowed and does not generate an exception.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.