Exemplo n.º 1
0
        static void Main(string[] args)
        {
            MyGenClass <int>     objint  = new MyGenClass <int>();
            MyGenClass <Student> objStud = new MyGenClass <Student>();
            MyGenClass <char>    objChar = new MyGenClass <char>();
            MyGenClass <byte>    objByte = new MyGenClass <byte>();

            MyGenClass <object>   obj    = new MyGenClass <object>();
            MyGenClass <string>   objstr = new MyGenClass <string>();
            MyGenClass <Employee> objemp = new MyGenClass <Employee>();
        }
Exemplo n.º 2
0
    private int Run()
    {
        MyGenClass <int> myObj1 = new MyGenClass <int>();

        Thread t = new Thread(new ParameterizedThreadStart(ThreadWorker));

        t.Start(myObj1);
        t.Join();
        Console.WriteLine(iSet == iNum ? "Test Passed" : "Test Failed");
        return(iSet == iNum ? 100 : -1);
    }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            //Value Types
            MyGenClass <int>     objint  = new MyGenClass <int>();
            MyGenClass <Student> objStud = new MyGenClass <Student>();
            MyGenClass <char>    objChar = new MyGenClass <char>();
            MyGenClass <byte>    objByte = new MyGenClass <byte>();

            //reference type
            MyGenClass <object>   obj         = new MyGenClass <object>();
            MyGenClass <string>   objString   = new MyGenClass <string>();
            MyGenClass <Employee> objEmployee = new MyGenClass <Employee>();
        }
Exemplo n.º 4
0
    static void Main()
    {
        MyGenClass <int> iob;

        iob = new MyGenClass <int>(88);

        int v = iob.Getob();

        Console.WriteLine("iob is an instance of MyGenClass<int>. \n" +
                          "the value returned by Getob() : " + v + "\n");

        MyGenClass <string> strob = new MyGenClass <string>("Generics Demo");

        string str = strob.Getob();

        Console.WriteLine("iob is an instance of MyGenClass<string>. \n" +
                          "the value returned by Getob() : " + str + "\n");
    }