Exemplo n.º 1
0
        public void returnTasInt()
        {
            Generics_Classes <int> genInt = new Generics_Classes <int>();
            int intData = genInt.GenericMethodAsReturnedFromTToInt(70);

            genInt.GenericPropertyWillBeConvertedToIntFromT = 483;
            Console.WriteLine("{0} - {1}", intData, genInt.GenericProperty);
        }
Exemplo n.º 2
0
        public void returnTasString()
        {
            //Here <T> type become string
            Generics_Classes <string> genStr = new Generics_Classes <string>();
            string strData = genStr.GenericMethodAsReturned("C#");

            genStr.GenericProperty = "Certification Exam: ";
            Console.WriteLine("{0} ---- {1}", strData, genStr.GenericProperty);
            Console.ReadKey();
        }
Exemplo n.º 3
0
 public void runGenericsConversion()
 {
     Generics_Classes <Person> genPer = new Generics_Classes <Person>();
     //Student is also a Person. This is also valid.
     Generics_Classes <Student> genStd = new Generics_Classes <Student>();
 }