public static LoggerSingleton GetInstance()
 {
     if (_loggerSingletonInstance == null)
     {
         _loggerSingletonInstance = new LoggerSingleton();
     }
     return(_loggerSingletonInstance);
 }
Exemple #2
0
 public static LoggerSingleton GetInstance()
 {
     if (instance == null)
     {
         instance = new LoggerSingleton("First and single instance of Logger class");
     }
     return(instance);
 }
Exemple #3
0
        static void Main(string[] args)
        {
            LoggerSingleton logger = LoggerSingleton.GetInstance();

            logger.GetInfo();

            LoggerSingleton logger2 = LoggerSingleton.GetInstance(); //it's the same instance of logger

            Console.WriteLine(logger.Equals(logger2));
            Console.ReadKey();
        }
Exemple #4
0
        public int ProcessTo(int end)
        {
            int sum = 0;

            for (int i = _start; i < end; ++i)
            {
                sum += i;
            }
            LoggerSingleton.GetInstance().Log("Processor just calculated some value: " + sum);

            return(sum);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var log = LoggerSingleton.GetInstance();

            log.AddToLog("123", "11111111");
            Console.WriteLine("message was add to log");


            log.AddToLog("D:\\DOCUMENTS\\test", "222");
            Console.WriteLine("message was add to log");

            Console.ReadLine();
        }
Exemple #6
0
 public static LoggerSingleton GetInstance()
 {
     return(_loggerSingletonInstance ?? (_loggerSingletonInstance = new LoggerSingleton()));
 }
Exemple #7
0
 public HardProcessor(int start)
 {
     _start = start;
     LoggerSingleton.GetInstance().Log("Processor just created");
 }