VB.Net Tutorial/Data Type/Integer Family — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 15:54, 26 мая 2010

Hexadecimal Byte, UInteger and Integer

<source lang="vbnet">Option Strict On Public Module modMain

  Public Sub Main()
     Dim maxValue As Byte = &HFF
     Dim posValue As UInteger = &HF034
     Dim negValue As Integer = &HF034
  
     Console.WriteLine(maxValue)
     Console.WriteLine(posValue)
     Console.WriteLine(negValue)
  End Sub

End Module</source>

255
61492
61492

Integer Family MaxValue

<source lang="vbnet">Public Class Tester

   Public Shared Sub Main
       Dim result As New System.Text.StringBuilder()
       result.AppendLine("MaxValue...")
       Dim maxByte As Byte = Byte.MaxValue
       Dim maxSByte As SByte = SByte.MaxValue
       Dim maxShort As Short = Short.MaxValue
       Dim maxUShort As UShort = UShort.MaxValue
       Dim maxInteger As Integer = Integer.MaxValue
       Dim maxUInteger As UInteger = UInteger.MaxValue
       Dim maxLong As Long = Long.MaxValue
       Dim maxULong As ULong = ULong.MaxValue
       result.Append("Byte ").AppendLine(maxByte)
       result.Append("SByte ").AppendLine(maxSByte)
       result.Append("Short ").AppendLine(maxShort)
       result.Append("UShort = ").AppendLine(maxUShort)
       result.Append("Integer = ").AppendLine(maxInteger)
       result.Append("UInteger = ").AppendLine(maxUInteger)
       result.Append("Long = ").AppendLine(maxLong)
       result.Append("ULong = ").AppendLine(maxULong)
       Console.WriteLine(result.ToString())
    End Sub

End Class</source>

MaxValue...
Byte 255
SByte 127
Short 32767
UShort = 65535
Integer = 2147483647
UInteger = 4294967295
Long = 9223372036854775807
ULong = 18446744073709551615