Tuesday, July 11, 2006

Singleton Pattern the way you should NOT do it

found this code today at c-sharp corner
public static SingleTon GetObject(){
if(instance == null)
instance = new SingleTon();
++m_nNofReference;
return instance;
}

Singleton Pattern

don't use it, it is not thread safe, you can read this instead if you want to learn about the singleton pattern

technorati tags:, ,

No comments: