SetArgument(int, object)
Sets the value of the ref or out argument at a given index. Replacing an argument value is supported only in some advices
and is silently ignored in unsupported scenarios. See Remarks for details.
Declaration
public override void SetArgument(int index, object value)Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of the argument. |
| object | value | The new value of the |
Overrides
Remarks
Replacing a parameter value is supported in the following scenarios:
- In OnSuccess(MethodExecutionArgs) and OnExit(MethodExecutionArgs) advices, to replace
the value of
refandoutparameters. - 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
refandoutparameters.
Setting the value in a different situation is unsupported and has unspecified behavior.
Exceptions
| Type | Condition |
|---|---|
| InvalidCastException |
|
| ArgumentOutOfRangeException |
|