How to exit a method in the OnEntry method of a PostSharp aspect based on condition

Posted by Michael Ulmann on Stack Overflow See other posts from Stack Overflow or by Michael Ulmann
Published on 2010-03-13T08:48:13Z Indexed on 2010/03/13 8:55 UTC
Read the original article Hit count: 659

Filed under:
|
|

I'd like the aspect to exit a method invocation based on a condition like the following:

    [AttributeUsage(AttributeTargets.Method)]
    public class IgnoreIfInactiveAttribute : OnMethodBoundaryAspect
    {
        public override void OnEntry(MethodExecutionEventArgs eventArgs)
        {
             if (condition)
            {
                **// How can I make the method return here?**
            }
        }
    }

Any help much appreciated.

© Stack Overflow or respective owner

Related posts about postsharp

Related posts about c#