本文整理匯總了VB.NET中System.Nullable<T>.Equals方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Nullable<T>.Equals方法的具體用法?VB.NET Nullable<T>.Equals怎麽用?VB.NET Nullable<T>.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Nullable<T>
的用法示例。
在下文中一共展示了Nullable<T>.Equals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Sample
' This code example demonstrates the Nullable(Of T).Equals
' methods.
Class Sample
Public Shared Sub Main()
Dim nullInt1 As Nullable(Of Integer) = 100
Dim nullInt2 As Nullable(Of Integer) = 200
Dim myObj As Object
' Determine if two nullable of System.Int32 values are equal.
' The nullable objects have different values.
Console.Write("1) nullInt1 and nullInt2 ")
If nullInt1.Equals(nullInt2) Then
Console.Write("are")
Else
Console.Write("are not")
End If
Console.WriteLine(" equal.")
' Determine if a nullable of System.Int32 and an object
' are equal. The object contains the boxed value of the
' nullable object.
myObj = CType(nullInt1, Object)
Console.Write("2) nullInt1 and myObj ")
If nullInt1.Equals(myObj) Then
Console.Write("are")
Else
Console.Write("are not")
End If
Console.WriteLine(" equal.")
End Sub
End Class
輸出:
1) nullInt1 and nullInt2 are not equal. 2) nullInt1 and myObj are equal.