本文整理匯總了VB.NET中System.Int32結構體的典型用法代碼示例。如果您正苦於以下問題:VB.NET Int32結構體的具體用法?VB.NET Int32怎麽用?VB.NET Int32使用的例子?那麽, 這裏精選的結構體代碼示例或許可以為您提供幫助。
在下文中一共展示了Int32結構體的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1:
Dim value1 As SByte = 124
Dim value2 As Int16 = 1618
Dim number1 As Integer = value1
Dim number2 As Integer = value2
示例2: CInt
Dim lNumber As Long = 163245617
Try
Dim number1 As Integer = CInt(lNumber)
Console.WriteLine(number1)
Catch e As OverflowException
Console.WriteLine("{0} is out of range of an Int32.", lNumber)
End Try
Dim dbl2 As Double = 35901.997
Try
Dim number2 As Integer = CInt(dbl2)
Console.WriteLine(number2)
Catch e As OverflowException
Console.WriteLine("{0} is out of range of an Int32.", dbl2)
End Try
Dim bigNumber As BigInteger = 132451
Try
Dim number3 As Integer = CInt(bigNumber)
Console.WriteLine(number3)
Catch e As OverflowException
Console.WriteLine("{0} is out of range of an Int32.", bigNumber)
End Try
輸出:
163245617 35902 132451