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> 对象。
返回
一个整数,指示和n1参数的n2相对值。
| 返回值 | 说明 |
|---|---|
| 小于零 | 该HasValue属性是n1false,其HasValue属性n2true是,或HasValuen1属性的和n2属性true,并且其Value属性的值n1小于Value属性的值。n2
|
| 零 | 属性和属性,或HasValuen1n2属性和属性false,其属性HasValue的值n1等于属性n2的值true。Valuen1Valuen2
|
| 大于零 | 该HasValue属性的值为n1,其trueHasValuen2属性为,或falseHasValue属性的和n1属性n2,并且其true属性的值Value大于n1该属性的值Value。n2
|
- 属性