Nullable.Equals<T>(Nullable<T>, Nullable<T>) 方法

定義

表示兩個指定 Nullable<T> 物件是否相等。

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

類型參數

T

基礎價值類型n1n2與參數。

參數

n1
Nullable<T>

Nullable<T> 物件。

n2
Nullable<T>

Nullable<T> 物件。

傳回

true若參數n1等於參數;n2否則,。 false

回傳值取決於HasValueValue比較的兩個參數的性質。

回報價值 描述
true HasValuen1n2性質為 false,或 HasValue 與 的n1n2性質為 true,且Value參數的性質相等。
false HasValue性質為 對一個參數 ,true對另一個參數 ,falseHasValue 和 的n1n2性質為 true,且Value參數的性質不相等。
屬性

適用於