Exemple #1
0
        static void Main()
        {
            MyGenerics<int, int> instance1 = new MyGenerics<int, int>(1, 2);
            Console.WriteLine(instance1.Variable1 + instance1.Variable2);

            MyGenerics<string, int> instance2 = new MyGenerics<string, int>("Number ", 1);
            Console.WriteLine(instance2.Variable1 + instance2.Variable2);

            MyGenerics<string, string> instance3 = new MyGenerics<string, string>("Hello ", "World");
            Console.WriteLine(instance3.Variable1 + instance3.Variable2);

            // Delay.
            Console.ReadKey();
        }
        static void Main()
        {
            MyGenerics <int, int, int> instance1 = new MyGenerics <int, int, int>(1, 2, 20);

            Console.WriteLine(instance1.Variable1 + instance1.Variable2 + instance1.Variable3);

            MyGenerics <string, int, double> instance2 = new MyGenerics <string, int, double>("Number ", 1, 20.1);

            Console.WriteLine(instance2.Variable1 + instance2.Variable2 + instance2.Variable3);

            MyGenerics <string, string, byte> instance3 = new MyGenerics <string, string, byte>("Hello ", "World", 8);

            Console.WriteLine(instance3.Variable1 + instance3.Variable2 + instance3.Variable3);

            // Delay.
            Console.ReadKey();
        }