Exemple #1
0
 public static void PrintInfo(Student student)
 {
     Format("Student Name: " + student.GetName());
     Format("Grade: " + student.Grade);
     PrintInfo(student.GetInstructor());
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Student sanyok1 = new Student("Sanyok", 100, 4);

            Console.WriteLine($"\nИмя студента : {sanyok1.GetName()}");
            Console.WriteLine($"Активы : {sanyok1.GetMoney()}");
            Console.WriteLine($"Пересдачи : {sanyok1.GetRetakes()}\n");
            Student sanyok2 = new Student();

            Console.WriteLine($"\nИмя студента : {sanyok2.GetName()}");
            Console.WriteLine($"Активы : {sanyok2.GetMoney()}");
            Console.WriteLine($"Пересдачи : {sanyok2.GetRetakes()}\n");
            Student sanyok3 = new Student();

            Console.WriteLine($"\nИмя студента : {sanyok3.GetName()}");
            Console.WriteLine($"Активы : {sanyok3.GetMoney()}");
            Console.WriteLine($"Пересдачи : {sanyok3.GetRetakes()}\n");

            Console.WriteLine($"1 EQUAL 2 ? : {sanyok1.Equals(sanyok2)}");
            Console.WriteLine($"2 EQUAL 3 ? : {sanyok2.Equals(sanyok3)}");

            Console.WriteLine($"HashCode 1 : {sanyok1.GetHashCode()}");
            Console.WriteLine($"HashCode 2 : {sanyok2.GetHashCode()}");


            Student copy1 = new Student("Copy1", 1000, 5);

            Student copystudent = new Student(copy1);

            OutputS.Output(sanyok1);
            OutputS.Output(sanyok2);
            OutputS.Output(copy1);
            OutputS.Output(copystudent);

            var man = new { Name = "Sasha", money = 125, retakes = 12 };

            Console.WriteLine(man.ToString());
            Console.WriteLine(man.GetType());

            Console.WriteLine("----------------------------------------");
            myList <string> lst = new myList <string>();

            lst.addItem("Sanya1");
            lst.addItem("Sanya2");
            lst.addItem("Sanya3");

            lst.printAll();

            lst.removeItem("Sanya2");

            Console.WriteLine("\nLST first:");
            lst.printAll();

            Console.WriteLine($"\nBool метод для Sanya2 : {lst.attend("Sanya2")}\n");
            myList <string> lst2 = new myList <string>();

            lst2.addItem("Misha1");
            lst2.addItem("Misha2");
            lst2.addItem("Sanya2");
            lst2.addItem("Sanya1");
            lst2.addItem("Misha3");

            Console.WriteLine("\nLST second:");
            lst2.printAll();

            lst.Merge(lst2);

            Console.WriteLine("\nAfter merge:");
            lst.printAll();


            Singleton <int> singleton = new Singleton <int>();

            singleton.addItem(25);
            singleton.addItem(15);

            Console.WriteLine("\nSingleton : ");
            singleton.printAll();
            Singleton <int> singleton2 = new Singleton <int>();

            Console.WriteLine("\nSingleton2 : ");
            singleton2.printAll();
            singleton.addItem(100);
            Console.WriteLine("\nAfter add to first. The second: ");
            singleton2.printAll();


            Console.ReadLine();
        }