Exemple #1
0
        internal static void Test3()
        {
            GenericCollection <int> intcoll = new GenericCollection <int>();

            intcoll.Add(100);
            GenericCollection <string> strColl = new GenericCollection <string>();

            strColl.Add("string1");
            GenericCollection <Employee> empcoll = new GenericCollection <Employee>();

            empcoll.Add(new Employee {
                EmployeeId = 1, EmployeeName = ""
            });
            int    x = intcoll.GetAt(0);
            string s = strColl[0];
            var    empList = empcoll.GetAll();
            int    a = 10, b = 20;
            double d1 = 10.0, d2 = 50.0;
            String s1 = "Hello", s2 = "World";

            Console.WriteLine($"Before Swap,\n\t a={a},a={a},b={b},\n\td1={d1},d2={d2}\n\ts1={s1},s2={s2}");
            Swap <int>(ref a, ref b);
            Swap <double>(ref d1, ref d2);
            Swap <string>(ref s1, ref s2);
            Console.WriteLine($"After Swap,\n\t a={a},a={a},b={b},\n\td1={d1},d2={d2}\n\ts1={s1},s2={s2}");
        }