Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Class1
- #Region "Variables"
- Private mstrName As String = String.Empty
- Private mintKey As Integer
- Shared mintCount As Integer
- Shared mCollection As Collection
- #End Region
- #Region "Constructor"
- Public Sub New(ByVal Name As String)
- mstrName = Name
- mintCount += 1
- mintKey = mintCount - 1
- mCollection.Add(Me, mintKey.ToString)
- End Sub
- Protected Overrides Sub Finalize()
- mintCount -= 1
- mintKey = mintCount - 1
- mCollection.Remove(mintKey.ToString)
- GC.Collect()
- End Sub
- #End Region
- #Region "Properties"
- Public ReadOnly Property Name As String
- Get
- Return mstrName
- End Get
- End Property
- #End Region
- #Region "Methods"
- Public Shared Sub Attack()
- If mintCount < 5 Then
- For Each o As Object In mCollection
- Console.WriteLine(o + ": Not me!")
- Next
- ElseIf mintCount >= 5 Then ' made this line a little more simple for you! <3
- For Each o As Object In mCollection
- Console.WriteLine(o + ": Attack! Attack! Attack!")
- Next
- End If
- End Sub
- #End Region
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement