Tuesday, October 02, 2007
Today I found this little piece of code

Public Class SingletonProvider(Of itemtype As {New})
    Public Sub New()
    End Sub


    Public Shared ReadOnly Property Instance() As itemtype

        Get
            Return SingletonCreator.instance
        End Get

    End Property
    Class SingletonCreator
        Shared Sub New()
        End Sub

        Public Shared ReadOnly instance As itemtype = New itemtype()
    End Class
End Class

From this site.

I find this very usefull code since it will allow me to create singleton forms. Making Forms singleton is nearly impossible as we all know because of the designer and VS. So we have to work around that a bit (yeah I know it's bad when you have to work around the IDE to get something done). And that's where this piece of code comes in handy.

10/2/2007 3:39 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback