本文整理匯總了VB.NET中System.DateTime.MaxValue字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTime.MaxValue字段的具體用法?VB.NET DateTime.MaxValue怎麽用?VB.NET DateTime.MaxValue使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.DateTime
的用法示例。
在下文中一共展示了DateTime.MaxValue字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Date
' Attempt to assign an out-of-range value to a DateTime constructor.
Dim numberOfTicks As Long = Int64.MaxValue
Dim validDate As Date
' Validate the value.
If numberOfTicks >= Date.MinValue.Ticks And _
numberOfTicks <= Date.MaxValue.Ticks Then
validDate = New Date(numberOfTicks)
ElseIf numberOfTicks < Date.MinValue.Ticks Then
Console.WriteLine("{0:N0} is less than {1:N0} ticks.",
numberOfTicks,
DateTime.MinValue.Ticks)
Else
Console.WriteLine("{0:N0} is greater than {1:N0} ticks.",
numberOfTicks,
DateTime.MaxValue.Ticks)
End If
輸出:
9,223,372,036,854,775,807 is greater than 3,155,378,975,999,999,999 ticks.