public static SinglePatternLazyDto GetInstanceWithThreadNotSafe() { if (uniqueInstance == null) { uniqueInstance = new SinglePatternLazyDto(); } return(uniqueInstance); }
public static SinglePatternLazyDto GetInstanceWithThreadSafe2() { if (uniqueInstance == null) { lock (locker) { if (uniqueInstance == null) { uniqueInstance = new SinglePatternLazyDto(); } } } return(uniqueInstance); }