static void Main(string[] args) { Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("This is the first message"); Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("This is the second message"); Console.WriteLine("----------------------------------------------"); // If Singleton wouldn't be sealed //Singleton.NestedDerivedSingleton derivedObj = new Singleton.NestedDerivedSingleton(); //derivedObj.PrintDetails("From nested derived class"); //Output: // Counter value: 1 // This is the first message // This is the second message // ---------------------------------------------- // Counter value: 2 // From nested derived class Console.ReadLine(); }
static void Main(string[] args) { Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("From Employee"); Singleton fromStudent = Singleton.GetInstance; fromEmployee.PrintDetails("From Student"); Console.WriteLine("-------------------------------"); //Singleton.DerivedSingleton derivedObj = new Singleton.DerivedSingleton(); //derivedObj.PrintDetails("From Derived"); Console.ReadLine(); }
static void Main(string[] args) { Singleton s1 = Singleton.GetInstance; s1.PrintDetails("This is first message."); Singleton s2 = Singleton.GetInstance; s2.PrintDetails("This is second message."); }
static void Main(string[] args) { Singleton fromTeachaer = Singleton.GetInstance; fromTeachaer.PrintDetails("Del porefesor"); Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("Del estudiante"); Console.ReadLine(); }
private static void PrintStudentdetails() { /* * Assuming Singleton is created from student class * we refer to the GetInstance property from the Singleton class */ Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("From Student"); }
private static void PrintEmployeeDetails() { /* * Assuming Singleton is created from employee class * we refer to the GetInstance property from the Singleton class */ Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("From Employee"); }
static void Main(string[] args) { Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("This is the first message"); Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("This is the second message"); Console.ReadLine(); }
static void Main(string[] args) { Singleton fromTeacher = Singleton.GetInstance; fromTeacher.PrintDetails("From teacher"); Singleton fromEstudent = Singleton.GetInstance; fromEstudent.PrintDetails("From student"); Console.ReadLine(); }
static void Main(string[] args) { Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("From Employee"); Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("From Student"); Console.ReadLine(); }
static void Main(string[] args) { Singleton fromemployee = Singleton.GetInstance; fromemployee.PrintDetails("from employee"); Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("from student"); //Singleton.DerivedSingleton ds = new SingletonDemo.Singleton.DerivedSingleton(); //ds.PrintDetails("from derived class"); Console.ReadLine(); }
static void Main(string[] args) { /* * Assuming Singleton is created from employee class * we refer to the GetInstance property from the Singleton class */ Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("From Employee"); /* * Assuming Singleton is created from student class * we refer to the GetInstance property from the Singleton class */ Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("From Student"); Console.ReadLine(); }
private static void PrintStudentDetails() { Singleton singleton = Singleton.GetInstance; singleton.PrintDetails("From Student Class"); }
private static void PrintDetails1() { Singleton s1 = Singleton.GetInstance; s1.PrintDetails("This is first message from S1"); }
private static void PrintEmployeeDetails() { Singleton p = Singleton.GetInstance; p.PrintDetails("hi"); }
private static void PrintDetails2() { Singleton s2 = Singleton.GetInstance; s2.PrintDetails("This is second message from S2"); }
private static void PrintStudentDetails() { Singleton s = Singleton.GetInstance; s.PrintDetails("hello"); }
private static void PrintStudentDetails() { Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("From Student object is getting created."); }
private static void PrintEmployeeDetails() { Singleton singleton2 = Singleton.GetInstance; singleton2.PrintDetails("From Employee Class"); }
private static void PrintEmployeeDetails() { Singleton fromEmployee = Singleton.GetInstance; fromEmployee.PrintDetails("From Employee"); }
private static void PrintTeacherDetails() { Singleton fromTeacher = Singleton.GetInstance; fromTeacher.PrintDetails("From Teacher"); }
private static void PrintStudentDetails() { Singleton fromStudent = Singleton.GetInstance; fromStudent.PrintDetails("From Student"); }
private static void PrintTeacherDetails() { Singleton fromTeacher = Singleton.GetInstance; fromTeacher.PrintDetails("From Teacher object is getting created."); }