Beispiel #1
0
        static void Main(string[] args)
        {
            Singleton fromTeacher = Singleton.GetInstance;

            fromTeacher.PrintDetails("From Teacher");
            Singleton fromStudent = Singleton.GetInstance;

            fromStudent.PrintDetails("From Student");

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Singleton fromEmployee = Singleton.Instance;

            fromEmployee.PrintDetails("This is the first message");

            Singleton fromStudent = Singleton.Instance;

            fromStudent.PrintDetails("This is the second message");

            Console.ReadLine();
        }
Beispiel #3
0
        private static void PrintCustomer()
        {
            Singleton s1 = Singleton.Instance;

            s1.PrintDetails("Customer");
        }
Beispiel #4
0
        private static void PrintEmployee()
        {
            Singleton s2 = Singleton.Instance;

            s2.PrintDetails("Employee");
        }
Beispiel #5
0
        private static void DisplayEmployee()
        {
            Singleton employee = Singleton.GetInstance;

            employee.PrintDetails("From Employee");
        }
Beispiel #6
0
        private static void DisplayStudent()
        {
            Singleton student = Singleton.GetInstance;

            student.PrintDetails("From Student");
        }
Beispiel #7
0
        private static void FromStu()
        {
            Singleton fromStudent = Singleton.GetInstance; // suppose this was needed in student class

            fromStudent.PrintDetails("from student");
        }
Beispiel #8
0
        private static void FromEmp()
        {
            Singleton fromEmployee = Singleton.GetInstance;// suppose this was needed on employee class

            fromEmployee.PrintDetails("from employee");
        }
Beispiel #9
0
        private static void PrintEmployeeDetails()
        {
            Singleton fromEmployee = Singleton.GetInstance;

            fromEmployee.PrintDetails("from employee");
        }
Beispiel #10
0
        private static void PrintStudentDetails()
        {
            Singleton fromStudent = Singleton.GetInstance;

            fromStudent.PrintDetails("from student");
        }
Beispiel #11
0
        public static void PrintObjectA1Details()
        {
            Singleton objectA1 = Singleton.GetInstance;

            objectA1.PrintDetails("This is from Object A1, Thread Safety");
        }