Open sandboxFocus

Method UseExistingParameter

UseExistingParameter(IParameter)

Creates a PullAction that means that the dependency should be pulled from an existing constructor parameter.

Declaration
public static PullAction UseExistingParameter(IParameter parameter)
Parameters
Type Name Description
IParameter parameter

The existing parameter to use.

Returns
Type Description
PullAction

A PullAction that uses the specified parameter.

Remarks

This action is useful when the child constructor already has a parameter with the value needed for the introduced parameter. For example, if you introduce an ILogger parameter to a base constructor, and a derived class constructor already has an ILogger logger parameter, you can use UseExistingParameter(loggerParam) to forward that value.