free hit counter javascript
Singleton - Dotmad (on .Net)

Dotmad (on .Net)

Just Another Web 5.0 Blog

Podcasts

Blogroll

Browse by Tags

All Tags » Singleton (RSS)
Generic Singleton Risks
The Singleton pattern is very well known to .Net developers, especially the static implementation. Lately I have encountered several versions of the generic Singleton , among them the one described in Arnon's post . However, there is one possible pitfall to this approach, as it makes this code possible: Singleton<MyClass> obj = Singleton<MyClass>.Instance; MyClass obj2 = new MyClass(); While I personally like the idea of having the freedom to use the same class in two different ways...