Пример #1
0
        public override void OnInvocation(Invocation invocation)
        {
            try
            {
                invocation.Proceed();
            }
            catch
            {
            }

            invocation.Result = 42;
        }
Пример #2
0
        public override void OnInvocation(Invocation invocation)
        {
            invocation.Proceed();

            string args = string.Join(", ",
                                      invocation.Arguments
                                        .Select(arg => arg == null ? "null" : arg.ToString())
                                        .ToArray());

            Console.WriteLine("{0}({1}) : {2}",
                              invocation.Method.Name, args, invocation.Result ?? "null");
        }