VB.NET Singleton Class


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Public Class ClassName
  2.  
  3. Private Shared objClassName As ClassName
  4. Private Shared blnClassAlreadyCreated As Boolean = False
  5.  
  6. Private Sub New()
  7. End Sub
  8.  
  9. Public Shared Function setupClass() As ClassName
  10. If blnClassAlreadyCreated = False Then
  11. objClassName = New ClassName()
  12. blnClassAlreadyCreated = True
  13. End If
  14. Return objClassName
  15. End Function
  16.  
  17. End Class

URL: http://www.ondotnet.com/pub/a/dotnet/2002/11/11/singleton.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.