当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET Int32结构体代码示例

本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:System,代码行数:5,代码来源:Int32


示例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
开发者ID:VB.NET开发者,项目名称:System,代码行数:23,代码来源:Int32

输出:

163245617
35902
132451



注:本文中的System.Int32结构体示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。