This post originated from an RSS feed registered with .NET Buzz
by Jonathan Crossland.
Original Post: The Singleton
Feed Title: Jonathan Crossland Weblog
Feed URL: http://www.jonathancrossland.com/syndication.axd
Feed Description: Design, Frameworks, Patterns and Idioms
From the Inbox: How do I code a singleton pattern?
I usually implement singletons in the following three ways.
The three implementations depend one or more usage requirements.
They in turn use the Instance, GetInstance and CreateInstance as instance creators.
// I used this the most often
 publicclass Singleton1  {    publicstaticreadonly Singleton1 Instance =new Singleton1();    
   private Singleton1(){}