WithArgs(object)
Sets the arguments that bind parameters and type parameters of the existing method by name.
Declaration
IExistingMethodInterception WithArgs(object args)Parameters
| Type | Name | Description |
|---|---|---|
| object | args | An anonymous object, an IReadOnlyDictionary<TKey, TValue> of names and values, or an IObjectReader. |
Returns
| Type | Description |
|---|---|
| IExistingMethodInterception |
Remarks
RedirectToExistingMethod(IMethod) describes how the arguments take precedence over the other values. A property that binds a parameter accepts these values:
- a literal:
null, a Boolean, a character, a number, a string or an enumeration value of a run-time-or-compile-time enumeration type; - a Type, which is written as
typeof; - a TypedConstant, for instance an array or a value of a run-time enumeration type;
- an expression of the site, which is Expression or Expression, and which passes the source argument or the source receiver, evaluated in the order of the source code;
- another IExpression, which is emitted at the site, for instance a parameter of the calling member, given by
Parameters, or the instance of the caller, given by
This() in the delegate given to ForEachSite(Func<IMethodInterceptionSite, IMethodInterception>)
when CanAccessThis is
true.
A property that binds a type parameter is a Type or an IType. A property that names no parameter and no type parameter is an error. An argument of the site can be passed to two parameters only when it is passed by value and its evaluation has no side effect. For a method group converted to a delegate or to a function pointer, the arguments can bind only type parameters.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException | A value of |