示例#1
0
        public void GM2 <Tgm2> (Tg2 param1, Tgm2 param2)
        {
            // Case 1: A generic method call that depends on its generic
            // context, because it uses the type parameters of the enclosing
            // generic type G2 and the enclosing generic method GM2. The token
            // for the MethodSpec is Tokens.Case1.
            G1 <Tg2> g = new G1 <Tg2>();

            g.GM1 <Tgm2>(param1, param2);

            // Case 2: A non-generic method call that depends on its generic
            // context, because it uses the type parameter of the enclosing
            // generic type G2. The token for the MemberRef is Tokens.Case2.
            g.M1(param1);

            // Case 3: A generic method call that does not depend on its generic
            // context, because it does not use type parameters of the enclosing
            // generic type or method. The token for the MethodSpec is Tokens.Case3.
            G1 <int> gi = new G1 <int>();

            gi.GM1 <object>(42, new Object());

            // Case 4: A non-generic method call that does not depend on its
            // generic context, because it does not use the type parameters of the
            // enclosing generic type or method. The token for the MethodDef is
            // Tokens.Case4.
            Example e = new Example();

            e.M();
        }
示例#2
0
        public void M()
        {
            G1 <int> g = new G1 <int>();

            // Case 5: A generic method call that does not have any generic
            // context. The token for the MethodSpec is Tokens.Case5.
            g.GM1 <object>(42, new Object());
        }