vb System.Int64类(方法)实例源码

下面列出了vb System.Int64 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:Syste   
Dim value1 As SByte = 124
Dim value2 As Int16 = 1618
Dim value3 As Int32 = Int32.MaxValue

Dim number1 As Long = value1
Dim number2 As Long = value2
Dim number3 As Long = value3

作者:VB.NET开发    项目:Syste   
Dim ulNumber As ULong = 163245617943825
Try
   Dim number1 As Long = CLng(ulNumber)
   Console.WriteLine(number1)
Catch e As OverflowException
   Console.WriteLine("{0} is out of range of an Int64.", ulNumber)
End Try

Dim dbl2 As Double = 35901.997
Try
   Dim number2 As Long = CLng(dbl2)
   Console.WriteLine(number2)
Catch e As OverflowException
   Console.WriteLine("{0} is out of range of an Int64.", dbl2)
End Try
   
Dim bigNumber As BigInteger = 1.63201978555e30
Try
   Dim number3 As Long = CLng(bigNumber)
   Console.WriteLine(number3)
Catch e As OverflowException
   Console.WriteLine("{0:N0} is out of range of an Int64.", bigNumber)
End Try

作者:VB.NET开发    项目:Syste   
Dim values() As Decimal = { Decimal.MinValue, -1034.23d, -12d, 0d, 147d, _
                            199.55d, 9214.16d, Decimal.MaxValue }
Dim result As Long

For Each value As Decimal In values
   Try
      result = Convert.ToInt64(value)
      Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", _
                        value.GetType().Name, value, _
                        result.GetType().Name, result)
   Catch e As OverflowException
      Console.WriteLine("{0} is outside the range of the Int64 type.", _
                        value)
   End Try   
Next

作者:VB.NET开发    项目:Syste   
Dim string1 As String = "244681903147"
Try
   Dim number1 As Long = Int64.Parse(string1)
   Console.WriteLine(number1)
Catch e As OverflowException
   Console.WriteLine("'{0}' is out of range of a 64-bit integer.", string1)
Catch e As FormatException
   Console.WriteLine("The format of '{0}' is invalid.", string1)
End Try

Dim string2 As String = "F9A3CFF0A"
Try
   Dim number2 As Long = Int64.Parse(string2,
                            System.Globalization.NumberStyles.HexNumber)
   Console.WriteLine(number2)
Catch e As OverflowException
   Console.WriteLine("'{0}' is out of range of a 64-bit integer.", string2)
Catch e As FormatException
   Console.WriteLine("The format of '{0}' is invalid.", string2)
End Try

作者:VB.NET开发    项目:Syste   
Dim numbers() As Long = { -1403, 0, 169, 1483104 }
For Each number In numbers
   ' Display value using default formatting.
   Console.Write("{0,-8}  -->   ", number.ToString())
   ' Display value with 3 digits and leading zeros.
   Console.Write("{0,8:D3}", number)
   ' Display value with 1 decimal digit.
   Console.Write("{0,13:N1}", number) 
   ' Display value as hexadecimal.
   Console.Write("{0,18:X2}", number)
   ' Display value with eight hexadecimal digits.
   Console.WriteLine("{0,18:X8}", number)
Next

作者:VB.NET开发    项目:Syste   
Dim numbers() As Long = { -146, 11043, 2781913 }
For Each number In numbers
   Console.WriteLine("{0} (Base 10):", number)
   Console.WriteLine("   Binary:  {0}", Convert.ToString(number, 2))
   Console.WriteLine("   Octal:   {0}", Convert.ToString(number, 8))
   Console.WriteLine("   Hex:     {0}", Convert.ToString(number, 16))
   Console.WriteLine()
Next


问题


面经


文章

微信
公众号

扫码关注公众号