示例#1
0
 public void EasyWork()
 {
     for (int i = 0; i < 5; i++)
     {
         var t = i;
         LoggerSingelton.GetInstance().Log($"EasyWork iteration {++t}");
     }
 }
示例#2
0
 public void HardWork()
 {
     for (int i = 0; i < 10; i++)
     {
         var t = i;
         LoggerSingelton.GetInstance().Log($"Iteration {++t}");
     }
 }
        static void Main(string[] args)
        {
            DoHardWork doHardWork = new DoHardWork();

            LoggerSingelton.GetInstance().Log("Start easy work !");
            doHardWork.EasyWork();
            LoggerSingelton.GetInstance().Log("Start hard work !");
            doHardWork.HardWork();
            ThreadSafeLoggerSingleton.GetInstance().Log("Thread Safe Logger !");
            Console.ReadKey();
        }