private Delegate GenerateInterceptor(Delegate targetDelegate)
        {
            Type delegateType = targetDelegate.GetType();
            MethodInfo mi = delegateType.GetMethod("Invoke");
            ParameterExpression[] parameters = (from p in mi.GetParameters()
                                                select Expression.Parameter(p.ParameterType, p.Name)).ToArray();

            var builder = new InterceptorFuncBuilder(this);
            return builder.CreateLambdaBody(parameters, delegateType, mi);
        }
Exemple #2
0
        private Delegate GenerateInterceptor(Delegate targetDelegate)
        {
            Type       delegateType = targetDelegate.GetType();
            MethodInfo mi           = delegateType.GetMethod("Invoke");

            ParameterExpression[] parameters = (from p in mi.GetParameters()
                                                select Expression.Parameter(p.ParameterType, p.Name)).ToArray();

            var builder = new InterceptorFuncBuilder(this);

            return(builder.CreateLambdaBody(parameters, delegateType, mi));
        }