Public Class YourClass
Private Shared ID as Integer = 10
Public Shared ReadOnly Property CurrentID as Integer
Get
Return ID
End Get
End Property
Public Shared Function GetID() as Integer
ID += 1
Return ID
End Function
Shared Sub New()
Console.WriteLine("Before init: " & ID)
ID = 100
Console.WriteLine("After init: " & ID)
End Sub
End Class
Module Test
Sub Main()
Dim CountValue As Integer
For CountValue = 1 to 10
Console.WriteLine(YourClass.GetID())
Next
End Sub
End Module
|