コード例 #1
0
        static void Main(string[] args)
        {
            //to use the generic Type example with an integer/string type parameter
            //Instatiating the class example//create an object
            listening <string> result  = new listening <string>("C#programming");
            listening <string> result1 = new listening <string>(".netProgramming");
            listening <int>    result2 = new listening <int>(12345);
            listening <int>    result3 = new listening <int>(78978);

            //Invoking the method Write() with object created result and result1

            result.Write();
            result1.Write();

            //Invoking the method read() with object created result2 and result3

            result2.read();
            result3.read();

            Console.ReadKey();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            //to use the generic Type example with an integer/string type parameter
            //Instatiating the class example//create an object


            sleeping <string> res  = new sleeping <string>("class is intersting");
            sleeping <string> res1 = new sleeping <string>("Iamnotsleeping");
            sleeping <int>    re   = new sleeping <int>(123);
            sleeping <int>    re1  = new sleeping <int>(456);

            listening <string> result  = new listening <string>("C#programming");
            listening <string> result1 = new listening <string>(".netProgramming");
            listening <string> result2 = new listening <string>("training program");
            listening <string> result3 = new listening <string>("by sachin sir");


            //Invoking the method beactive with object created res and res1


            res.beactive();
            res1.beactive();

            //Invoking the method active with object created re and re1

            re.active();
            re1.active();
            //Invoking the method Write() with object created result and result1

            result.Write();
            result1.Write();

            //Invoking the method read() with object created result2 and result3

            result2.read();
            result3.read();

            Console.ReadKey();
        }