Пример #1
0
        static void SampleMultiThreadSingleton()
        {
            LogFileSingleton _sampleLog = LogFileSingleton.ThreadSafeGetInstance();
            Thread           threadA    = new Thread(() => _sampleLog.LogContent("Log Content A"));
            Thread           threadB    = new Thread(() => _sampleLog.LogContent("Log Content B"));

            threadA.Start();
            threadB.Start();
        }
Пример #2
0
        static void SampleSingleton()
        {
            LogFileSingleton _sampleLog = LogFileSingleton.LazyGetInstance();

            _sampleLog.LogContent("Sample Log");
        }