Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Generics1 g1 = new Generics1();

            g1.generics(10, 20);
            g1.generics <float>(1.1f, 2.1f);
            g1.generics(12.1, 32.2);
            g1.generics <string>("hello", "Welcome");
            Console.Read();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Generic on method
            Generics1 g1     = new Generics1();
            bool      result = g1.Compare <int>(10, 25);

            Console.WriteLine(result);



            Generics2 g2 = new Generics2();

            g2.Add <float>(10.4f, 20.50f);
            g2.Sub <float>(12.25f, 65.0f);


            //Generic on Class
            Generics3 <float> g3 = new Generics3 <float>();

            g3.Add(10.6f, 2.2f);
            g3.Sub(25f, 25.4f);
        }