Open sandboxFocus

Property Parameters

Parameters

Gets the parameters of Member when it is a method, a constructor or an indexer. The parameters of a lambda or a local function that contains the site are not included.

Declaration
IParameterList Parameters { get; }
Property Value
Type Description
IParameterList
Remarks

A parameter can be passed to an existing interceptor through WithArgs(object), because an IParameter is an IExpression. It is written at the site as its name.

When a lambda or a local function that contains the site declares a parameter or a local variable with the same name, the linker renames this variable in the compiled code, so that the name designates the parameter of the member, and reports the warning LAMA0661.

The generated code does not compile when a lambda or a local function that contains the site cannot capture the parameter. Before passing the parameter, check that IsInNestedFunction is false, or that IsInStaticFunction is false, that the RefKind of the parameter is None, and that its type is not a ref struct.

Exceptions
Type Condition
InvalidOperationException

Member has no parameters, because it is a field, a property or an event.