VB.Net Tutorial/Class Module/Public — различия между версиями

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

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

Public Const

Imports System
Module MyTest
  Sub Main()
    Console.WriteLine(Counter.MIN_COUNT)
    Console.WriteLine(Counter.MAX_COUNT)
    Dim input As Integer = 100
    if input < Counter.MIN_COUNT or _
       Input > Counter.MAX_COUNT Then
      Console.WriteLine("Value is out of acceptable range!")
    Else
      Console.WriteLine("The value " & input.ToString() & _
                        " is acceptable!")
    End If
    
  End Sub
End Module
Public Class Counter
  Public Const MAX_COUNT As Integer = 500
  Public Const MIN_COUNT As Integer = 100
End Class
100
500
The value 100 is acceptable!

Public members are available to anything that can instantiate this type

Public Class SomeClassInMyAssembly
    
    Public vPublic As Integer
End Class