Open sandboxFocus

Class OnMethodSuccessAdvice

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice that has the same semantics as OnSuccess(MethodExecutionArgs).

Inheritance
OnMethodSuccessAdvice
Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class OnMethodSuccessAdvice : OnMethodBoundaryAdvice
Remarks

The method to which this custom attribute is applied must be public and must return void. It can be static. Each parameter of the method receives a value of the target, selected by a custom attribute derived from AdviceParameterAttribute, such as ArgumentAttribute, ReturnValueAttribute or StateAttribute. Alternatively, the method can have the same signature as OnSuccess(MethodExecutionArgs), whose MethodExecutionArgs parameter is allocated on each call. The MethodExecutionArgs parameter can also be the first parameter, followed by bound parameters.


If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

note

A master advice without a custom attribute derived from Pointcut applies to the method or constructor to which the aspect is applied; when the aspect is applied to another kind of declaration, a pointcut is required. An advice without Master and without pointcut joins the group of the master advice declared in its class.

Constructors

Name Description
OnMethodSuccessAdvice()

See Also