Redigera

Dela via


Nullable.Equals<T>(Nullable<T>, Nullable<T>) Method

Definition

Indicates whether two specified Nullable<T> objects are equal.

public:
generic <typename T>
 where T : value class static bool Equals(Nullable<T> n1, Nullable<T> n2);
public static bool Equals<T> (T? n1, T? n2) where T : struct;
[System.Runtime.InteropServices.ComVisible(true)]
public static bool Equals<T> (T? n1, T? n2) where T : struct;
static member Equals : Nullable<'T (requires 'T : struct)> * Nullable<'T (requires 'T : struct)> -> bool (requires 'T : struct)
[<System.Runtime.InteropServices.ComVisible(true)>]
static member Equals : Nullable<'T (requires 'T : struct)> * Nullable<'T (requires 'T : struct)> -> bool (requires 'T : struct)
Public Shared Function Equals(Of T As Structure) (n1 As Nullable(Of T), n2 As Nullable(Of T)) As Boolean

Type Parameters

T

The underlying value type of the n1 and n2 parameters.

Parameters

n1
Nullable<T>

A Nullable<T> object.

n2
Nullable<T>

A Nullable<T> object.

Returns

true if the n1 parameter is equal to the n2 parameter; otherwise, false.

The return value depends on the HasValue and Value properties of the two parameters that are compared.

Return Value Description
true The HasValue properties for n1 and n2 are false, or the HasValue properties for n1 and n2 are true, and the Value properties of the parameters are equal.
false The HasValue property is true for one parameter and false for the other parameter, or the HasValue properties for n1 and n2 are true, and the Value properties of the parameters are unequal.
Attributes

Applies to