Nullable.Compare<T>(Nullable<T>, Nullable<T>) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
比較兩個 Nullable<T> 物體的相對價值。
public:
generic <typename T>
where T : value class static int Compare(Nullable<T> n1, Nullable<T> n2);
public static int Compare<T>(T? n1, T? n2) where T : struct;
[System.Runtime.InteropServices.ComVisible(true)]
public static int Compare<T>(T? n1, T? n2) where T : struct;
static member Compare : Nullable<'T (requires 'T : struct)> * Nullable<'T (requires 'T : struct)> -> int (requires 'T : struct)
[<System.Runtime.InteropServices.ComVisible(true)>]
static member Compare : Nullable<'T (requires 'T : struct)> * Nullable<'T (requires 'T : struct)> -> int (requires 'T : struct)
Public Shared Function Compare(Of T As Structure) (n1 As Nullable(Of T), n2 As Nullable(Of T)) As Integer
類型參數
- T
基礎價值類型n1n2與參數。
參數
- n1
- Nullable<T>
Nullable<T> 物件。
- n2
- Nullable<T>
Nullable<T> 物件。
傳回
一個整數表示 和 n2 參數的n1相對值。
| 回報價值 | 描述 |
|---|---|
| 低於零 |
HasValue的n1性質為 false,HasValue且 的n2性質是 true,或 HasValue 的n1n2性質為 true,且 Value 的n1性質值小Value於 的n2性質值。
|
| 零 | 與 的性質為 false,或 HasValue 與 的n1n2性質為 true,且 Value 的n1性質值等於 Value 的n2性質值。n1n2HasValue
|
| 大於零 |
HasValue的n1性質為 true,HasValue且 的n2性質為 false,或 HasValue 的n1n2性質為 true,且 Value 的n1性質值大於 Value 的n2性質值。
|
- 屬性