Taking advantage of the .NET framework, a singleton can be implemented as
follows:
// .NET Singleton
sealed class Singleton
{
private Singleton() {}
public static readonly Singleton Instance = new Singleton();
}
Read the article at http://msdn.microsoft.com/en-us/library/ms954629.aspx
Sir, Seeing at your article I re-called that few days back I read about Multiton pattern. Similarity between Singleton & Multiton is they both are aware of their instance(s). For more details: http://en.wikipedia.org/wiki/Multiton_pattern
ReplyDeleteVivek Gheewala
Vivek, thanks for the pointer.
ReplyDelete