VB.Net by API/System/Integer — различия между версиями

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

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

Integer.CompareTo

  
 
public class Test
   public Shared Sub Main
        Dim I As Integer = 0
        Dim S As Integer = 8
        Console.WriteLine(I.rupareTo(S))
   End Sub
End class


Integer.GetType

  
Module Module1
  Const x As String = "This is a string"
  Sub Main()
    Dim a As Double = 5.678
    Dim b As Int32 = 123
    Console.WriteLine(a.ToString)
    Console.WriteLine(b.ToString)
    Console.WriteLine(456.987.ToString)
    Dim c As Integer
    Console.WriteLine(c.GetType())
    Console.WriteLine(c.GetType().ToString)
  End Sub
End Module


Integer.MaxValue

  
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


Integer.MinValue

  
public class Test
   public Shared Sub Main
               Dim iNum As Integer
               Console.WriteLine("Integer: " & iNum.MinValue & " to " & iNum.MaxValue)
   End Sub
End class


Integer.Parse

  
Imports System
Imports System.Configuration
Imports System.Resources " Resource readers
Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Dim flag As Boolean = False
        Dim name As String = ""
        Dim number As Integer = 0
        Dim i As Integer
        For i = 0 To args.Length - 1
            Select Case args(i)
                Case "/flag"
                    flag = True
                Case "/name"
                    i += 1
                    name = args(i)
                Case "/number"
                    i += 1
                    number = Integer.Parse(args(i))
                Case Else
                    Console.WriteLine("invalid args!")
                    Exit Sub
            End Select
        Next
        Console.WriteLine(flag.ToString(), "Flag")
        Console.WriteLine(name, "Name")
        Console.WriteLine(number.ToString(), "Number")

    End Sub
End Class


Integer.ToString()

  
Imports System
Imports System.Data
Imports System.Collections
public class MainClass
   Shared Sub Main()
        Dim A As Boolean
        Dim I As Integer
        I = 5
        A = CBool(I)
        Console.WriteLine("Value of Boolean assigned from 5 is : " + A.ToString())
        I = CInt(A)
        Console.WriteLine("And converted back to Integer: " + I.ToString())
   End Sub
End Class