Public Class Singleton
Private Shared SP As Singleton
Private InnerList as New Collections.ArrayList()
Private Sub New()
End Sub
Public Shared Function Create() As Singleton
If SP is Nothing Then SP = New Singleton()
Return SP
End Function
Public ReadOnly Property List As Collections.ArrayList
Get
Return InnerList
End Get
End Property
End Class
Module SingletonExample
Sub Main
Dim CountValue as Integer
Dim SP As Singleton = Singleton.Create()
Dim SP2 As Singleton = Singleton.Create()
SP.List.Add("First")
SP.List.Add("Second")
SP.List.Add("Third")
For CountValue = 0 To SP2.List.Count - 1
Console.WriteLine(SP2.List.Item(CountValue).ToString())
Next
End Sub
End Module