public IMethodInvocationResult Intercept(ISyncMethodInvocation methodInvocation) { var argument = methodInvocation.GetArgument("value"); var argumentValue = (int)argument.Value; if (argumentValue < 0) { argument.Value = -argumentValue; } return methodInvocation.InvokeNext(); }
public IMethodInvocationResult Intercept(ISyncMethodInvocation methodInvocation) { var argument = methodInvocation.GetArgument("value"); var argumentValue = (int)argument.Value; int result; return PrecalculatedValues.TryGetValue(argumentValue, out result) ? methodInvocation.CreateResult(result) : methodInvocation.InvokeNext(); }
public IMethodInvocationResult Intercept(ISyncMethodInvocation methodInvocation) { return methodInvocation.InvokeNext(); }