本文整理匯總了VB.NET中System.Int32.MaxValue字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET Int32.MaxValue字段的具體用法?VB.NET Int32.MaxValue怎麽用?VB.NET Int32.MaxValue使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.Int32
的用法示例。
在下文中一共展示了Int32.MaxValue字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: modMain
Module modMain
Public Sub Main()
Dim numbersToConvert() As Long = { 162345, 32183, -54000, Int64.MaxValue\2 }
Dim newNumber As Integer
For Each number As Long In NumbersToConvert
If number >= Int32.MinValue And number <= Int32.MaxValue Then
newNumber = Convert.ToInt32(number)
Console.WriteLine("Successfully converted {0} to an Int32.", _
newNumber)
Else
Console.WriteLine("Unable to convert {0} to an Int32.", number)
End If
Next
End Sub
End Module
輸出:
Successfully converted 162345 to an Int32. Successfully converted 32183 to an Int32. Successfully converted -54000 to an Int32. Unable to convert 4611686018427387903 to an Int32.