Пример #1
0
        public void TestMultiThreadedSingletonInstanceEquals()
        {
            MultiThreadedSingleton obj  = MultiThreadedSingleton.Instance;
            MultiThreadedSingleton obj2 = MultiThreadedSingleton.Instance;

            Assert.AreEqual(obj, obj2);
        }
Пример #2
0
 public static MultiThreadedSingleton GetInstance(string value)
 {
     if (_instance == null)
     {
         lock (_lock)
         {
             if (_instance == null)
             {
                 _instance       = new MultiThreadedSingleton();
                 _instance.Value = value;
             }
         }
     }
     return(_instance);
 }