found this code today at c-sharp corner
public static SingleTon GetObject(){
if(instance == null)
instance = new SingleTon();
++m_nNofReference;
return instance;
}
don't use it, it is not thread safe, you can read this instead if you want to learn about the singleton pattern
No comments:
Post a Comment