本文整理汇总了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.