Esempio n. 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            GenericClass <string> obj = new GenericClass <string>(21, "Karol", "19-07-1997");

            GenericClass <string> .Print(obj);

            Console.WriteLine("Get year: " + obj.year.ToString());

            obj.year = 23;
            Console.WriteLine("Set year: " + obj.year);

            Console.WriteLine("Printing a second class thing");
            Console.WriteLine("Printing what object was sent through parameter");
            Console.WriteLine("Used 'where' keyword.");
            GenericClass2 <GenericClass <string> > .Printer(obj);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            PairFloat i = new PairFloat();

            i.X = 5;
            i.Y = 10;

            PairFloat f = new PairFloat();

            f.X = 5.5;
            f.Y = 10.1;

            PairString str = new PairString();

            str.X = "Rabbi";
            str.Y = "Robin";

            Pair <int, string> p = new Pair <int, string>();

            p.X = 01;
            p.Y = "Rabbi";

            Pair <A, B> p2 = new Pair <A, B>();

            p2.X = new A();
            p2.Y = new B();

            p2.X.Name = "Rabbi";
            p2.Y.City = "Dhaka";

            GenericClass <A, int> a = new GenericClass <A, int>();
            GenericClass <B, int> b = new GenericClass <B, int>();

            GenericClass2 <A, int> a1 = new GenericClass2 <A, int>();

            a1.DoSomething(5, 2.5, 7);
            GenericClass2 <B, int> b1 = new GenericClass2 <B, int>();
        }