Arguments.SetArgument Method |
Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.5.15.0 (6.5.15.0)
public virtual void SetArgument( int index, Object value )
Parameters
- index
- Type: System.Int32
Argument index. - value
- Type: System.Object
New value of the ref or out argument at position index.
Exception | Condition |
---|---|
InvalidCastException | value is not assignable to parameter at position index. |
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count. |
Replacing a parameter value is supported in the following scenarios:
- In OnSuccess(MethodExecutionArgs) and OnExit(MethodExecutionArgs) advices, to replace the value of ref and out parameters.
- In any interception advice (such as OnInvoke(MethodInterceptionArgs) or OnSetValue(LocationInterceptionArgs)), to set the value passed to the next node in the chain of responsibility, or the value of ref and out parameters.
Setting the value in a different situation is unsupported and has unspecified behavior.