ISimpleMethodInterceptor Interface |
Namespace: Cauldron.Interception
public interface ISimpleMethodInterceptor
The ISimpleMethodInterceptor type exposes the following members.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class MyInterceptorAttribute : Attribute, ISimpleMethodInterceptor { public void OnEnter(Type declaringType, object instance, MethodBase methodbase, object[] values) { } }
public class SampleClass { [MyInterceptor] public void SampleMethod() { Debug.WriteLine("Blablablablablabla"); } }
public class SampleClass { public void SampleMethod() { var interceptorAttribute = new MyInterceptorAttribute(); interceptorAttribute.OnEnter(typeof(SampleClass), this, MethodBase.GetMethodFromHandle(methodof(SampleClass.SampleMethod()).MethodHandle, typeof(SampleClass).TypeHandle), new object[0]); Debug.WriteLine("Blablablablablabla"); } }