[.NET - CSharp] Speaking of Singleton

Speaking of using the Singleton pattern in C#, have a look at Design Patterns potential hazards on Fabrice's weblog and follow the links to the articles he recommends. Also, have a gander at .Net singleton pattern multi-threading issue... by Chris Johnson. An old friend (and ex co-worker) just sent me another great link to an IBM Developer Works article with advice on how to Use your singletons wisely. MSDN has Implementing Singleton in C#, as pointed out by Luciano Evaristo Guerche who was recently cited by Scott Watermasysk. A comment in Luciano's post also points to Implementing the Singleton Pattern in C#.

Gee, I guess that's enough cross-posting about the Singleton for now! These articles contain a lot of information on something that seems so simple on the calm surface but has monsters lurking in the depths.

All in all, design patterns are great but you need to use them intelligently and with attention to your intended purpose. Perhaps you do not need to worry about threading issues; perhaps you do. The main thing is to ask the right questions when you do the design.

No Comments