ForEachSite(Func<IMethodInterceptionSite, IMethodInterception>)
Decides the interception of each call site with a delegate, for instance to skip some call sites or to choose a template per site.
Declaration
IMethodInterception ForEachSite(Func<IMethodInterceptionSite, IMethodInterception> intercept)Parameters
| Type | Name | Description |
|---|---|---|
| Func<IMethodInterceptionSite, IMethodInterception> | intercept | The delegate. It receives the call site, which describes the site and creates its result, and returns a result
created by this site during this invocation, for instance |
Returns
| Type | Description |
|---|---|
| IMethodInterception |
Remarks
The delegate can report diagnostics through Diagnostics. An exception thrown by the delegate is reported as an error on the declaration that contains the site, and the site is not intercepted.
The delegate is invoked only for call sites written in the source code. A call that the compiler, the runtime or a library makes on behalf of the code is never presented, because no call exists at the site.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|