Ivan and the other guys in Wellington had their last Lunch with Geeks about Design Patterns. And came out with that idea:
The most overused design pattern : Singleton. With the remark that a singleton should only be used when you need to keep state in your object internally.
So, just to reinforce that concept, here is a VS2005 code snippet to quickly create a Singleton. I uploaded it on GotCodeSnippets.NET, a repository of code snippets.
Download the Singleton VS2005 code snippet.
It expands to the following code:
public sealed class Singleton
{
private readonly static Singleton _instance = new Singleton();
public static Singleton Current
{
get
{
return _instance;
}
}
private Singleton()
{
//Implement here the initialization of your singleton
}
}
You can get more information about the Singleton pattern on the DoFactory site and on Jon Skeet's article. But beware the Singleton: Why Singleton are Evil.