Beispiel #1
0
        public override void OnInvocation(Invocation invocation)
        {
            Type type = invocation.Arguments[0].GetType();

            int value = Convert.ToInt32(invocation.Arguments[0]);
            value += 1;
            invocation.Arguments[0] = Convert.ChangeType(value, type);
        }
Beispiel #2
0
        public override void OnInvocation(Invocation invocation)
        {
            try
            {
                invocation.Proceed();
            }
            catch
            {
            }

            invocation.Result = 42;
        }
Beispiel #3
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");
        }
Beispiel #4
0
 public override void OnInvocation(Invocation invocation)
 {
     invocation.Result = 911;
     invocation.Cancel();
 }
Beispiel #5
0
 public virtual void OnInvocation(Invocation invocation)
 {
 }
Beispiel #6
0
 void IInterceptor.Intercept(Invocation invocation)
 {
     OnInvocation(invocation);
 }