public InterceptionAspectGenerator(object instance, BindingRestrictions rule, IEnumerable <MethodInterceptionAspect> aspects, MethodInfo method, IEnumerable <DynamicMetaObject> args, IEnumerable <Type> argsTypes) { _rule = rule; _aspects = aspects; _originalArgs = args; var argsValues = args.Select(x => x.Value).ToArray(); _isRetValue = method.ReturnType != typeof(void); _isByRefArgs = argsTypes.Any(t => t.IsByRef); if (_isByRefArgs) { if (_isRetValue) { _aspectArgs = new FuncInterceptionRefArgs(instance, method, argsValues, DelegateFactory.CreateDelegate(instance, method)); } else { _aspectArgs = new ActionInterceptionRefArgs(instance, method, argsValues, DelegateFactory.CreateDelegate(instance, method)); } } else { if (_isRetValue) { _aspectArgs = new FuncInterceptionArgs(instance, method, argsValues, DelegateFactory.CreateFunction(instance, method)); } else { _aspectArgs = new ActionInterceptionArgs(instance, method, argsValues, DelegateFactory.CreateMethodCall(instance, method)); } } }