VB.Net Tutorial/Language Basics/static — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:40, 26 мая 2010
Call static method
Option Strict On
Public Module CallStaticMethod
Public Sub Main()
Console.WriteLine(Greeting.SayHello())
End Sub
End Module
Public Class Greeting
Public Shared Function SayHello() As String
Return "And a top of the morning to you!"
End Function
End Class
And a top of the morning to you!
static Variable
Option Strict On
Public Module Test
Public Sub Main()
For loopCtr As Integer = 1 to 10
Console.WriteLine(Invocations())
Next
End Sub
Private Function Invocations() As Integer
Static i As Integer
i += 1
Return i
End Function
End Module
1 2 3 4 5 6 7 8 9 10