Esempio n. 1
0
        public static SinglePatternLazyDto GetInstanceWithThreadNotSafe()
        {
            if (uniqueInstance == null)
            {
                uniqueInstance = new SinglePatternLazyDto();
            }

            return(uniqueInstance);
        }
Esempio n. 2
0
 public static SinglePatternLazyDto GetInstanceWithThreadSafe2()
 {
     if (uniqueInstance == null)
     {
         lock (locker)
         {
             if (uniqueInstance == null)
             {
                 uniqueInstance = new SinglePatternLazyDto();
             }
         }
     }
     return(uniqueInstance);
 }