Nullable<'T>.Equals Method (Object)
Indicates whether the current Nullable<'T> object is equal to a specified object.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- other
-
Type:
System.Object
An object.
Return Value
Type: System.Booleantrue if the other parameter is equal to the current Nullable<'T> object; otherwise, false.
This table describes how equality is defined for the compared values:
Return Value | Description |
|---|---|
true | The HasValue property is false, and the other parameter is null. That is, two null values are equal by definition. -or- The HasValue property is true, and the value returned by the Value property is equal to the other parameter. |
false | The HasValue property for the current Nullable<'T> structure is true, and the other parameter is null. -or- The HasValue property for the current Nullable<'T> structure is false, and the other parameter is not null. -or- The HasValue property for the current Nullable<'T> structure is true, and the value returned by the Value property is not equal to the other parameter. |
If the HasValue property of the current Nullable<'T> structure is true and the other argument is not null, equality is determined by passing the other parameter to the Equals method of the underlying value of the current Nullable<'T> structure.
The following code example determines whether an object and a Nullable<'T> object are equal to the current Nullable<'T> object.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1