System.Nullable<T>.Equals Method

Indicates whether the current Nullable`1 object is equal to a specified object.

Syntax

public override bool Equals (object other)

Parameters

other
An object.

Returns

true if the other parameter is equal to the current Nullable`1 object; otherwise, false.

This table describes how equality is defined for the compared values:

true

The Nullable`1.HasValue property is false, and the other parameter is null. That is, two null values are equal by definition.

-or-

The Nullable`1.HasValue property is true, and the value returned by the Nullable`1.Value property is equal to the other parameter.

false

The Nullable`1.HasValue property for the current Nullable`1 structure is true, and the other parameter is null.

-or-

The Nullable`1.HasValue property for the current Nullable`1 structure is false, and the other parameter is not null.

-or-

The Nullable`1.HasValue property for the current Nullable`1 structure is true, and the value returned by the Nullable`1.Value property is not equal to the other parameter.

Remarks

If the Nullable`1.HasValue property of the current Nullable`1 structure is true, equality is determined by passing the other parameter to the Equals method of the underlying value of the current Nullable`1 structure.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0