Open sandboxFocus

Method WithArgs

WithArgs(object)

Sets the arguments of the template.

Declaration
ITemplateInterception WithArgs(object args)
Parameters
Type Name Description
object args

An anonymous object, an IReadOnlyDictionary<TKey, TValue> of names and values, or an IObjectReader. A property whose name is a compile-time parameter or type parameter of the template gives the value of that parameter. A property whose name is a run-time parameter of the template adds a parameter of that name and type to the synthesized method, and gives the value that each call site passes to it. A property whose name is a parameter that a Configure(Action<IInterceptorMethodBuilder>) delegate adds gives the value of that parameter. Such a value takes any form that WithArgs(object) accepts.

Returns
Type Description
ITemplateInterception
Remarks

The arguments are compared by value to decide which call sites share the synthesized method.

Exceptions
Type Condition
ArgumentNullException

args is null.