September 2006
Monthly Archive
Monthly Archive
Since I used to be a Java programmer, I used to write singletons in c# like this:
public class MySingleton { private static MySingleton instance; public static MySingleton Instance { get { if (instance == null) { lock(typeof(MySingleton)) { if (instance == null) { instance = new MySingleton(); } } } return instance; } private MySingleton() { // do init } }
Until I wanted to show a colleague the data & object factory site, a design patterns website specifically targeted at c# development.
4 comments Thursday 28 Sep 2006 | Guy Mahieu | .net(t) , c#(t) , design patterns(t)