Exemple #1
0
            public static void PassGenericObject <DataType>(GTest <DataType> g1)
            {
                Helper.TS(g1.v);    // wrong
                g1.TS(g1.v);        // wrong
                g1.MyTS(new Helper());

                Helper h = new Helper();

                h.TS2(g1.v);
            }
Exemple #2
0
            public static void UT()
            {
                GTest <DateTime> g1 = new GTest <DateTime>(new DateTime(2011, 1, 1));

                Helper.TS(g1.v);    // OK TS(DateTime) is invoked;
                g1.TS(g1.v);        // OK GTest<>::TS(DateTime) is invoked;
                g1.MyTS(new Helper());

                Helper h = new Helper();

                h.TS2(g1.v);

                // g1的Generic型別,只在這個區段中有用,只要進入其它區段就好像看不見一樣
                PassGenericObject(g1);
            }