CodeMethodInvokeExpression如果要调的方法不是静态方法也可以吗

解决方案 »

  1.   

    传入一个对象实例
    CodeMethodInvokeExpression methodInvoke = new CodeMethodInvokeExpression(
        // targetObject that contains the method to invoke.
        new CodeThisReferenceExpression(),
        // methodName indicates the method to invoke.
        "Dispose",
        // parameters array contains the parameters for the method.
        new CodeExpression[] { new CodePrimitiveExpression(true) } );// A C# code generator produces the following source code for the preceeding example code:// this.Dispose(true);
      

  2.   

    生成什么样的代码能否详细点,为什么是this.Dispose()?
    如果实在没更好解释分也只好给你了