Friday 16 September 2011

static Variable

Option Strict On

Public Module Test
   Public Sub Main()
      For loopCtr As Integer = 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

No comments:

Post a Comment