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); }
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)); }