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