Open sandboxFocus

Method IntroduceParameter

IntroduceParameter(IConstructor, string, IType, TypedConstant, Func<IParameter, IConstructor, PullAction>?, ImmutableArray<AttributeConstruction>)

Appends a parameter to a constructor by specifying its name and IType.

Declaration
IIntroductionAdviceResult<IParameter> IntroduceParameter(IConstructor constructor, string parameterName, IType parameterType, TypedConstant defaultValue, Func<IParameter, IConstructor, PullAction>? pullAction = null, ImmutableArray<AttributeConstruction> attributes = default)
Parameters
Type Name Description
IConstructor constructor

The constructor into which the new parameter will be appended.

string parameterName

The name of the parameter.

IType parameterType

The type of the parameter.

TypedConstant defaultValue

The default value of the parameter (required). It must be type-compatible with parameterType. To specify default as the default value, use Default(IType).

Func<IParameter, IConstructor, PullAction> pullAction

An optional delegate that returns a PullAction specifying how to pull the new parameter from other child constructors. A null value is equivalent to None, i.e. defaultValue of the parameter will be used.

ImmutableArray<AttributeConstruction> attributes
Returns
Type Description
IIntroductionAdviceResult<IParameter>

IntroduceParameter(IConstructor, string, Type, TypedConstant, Func<IParameter, IConstructor, PullAction>?, ImmutableArray<AttributeConstruction>)

Appends a parameter to a constructor by specifying its name and Type.

Declaration
IIntroductionAdviceResult<IParameter> IntroduceParameter(IConstructor constructor, string parameterName, Type parameterType, TypedConstant defaultValue, Func<IParameter, IConstructor, PullAction>? pullAction = null, ImmutableArray<AttributeConstruction> attributes = default)
Parameters
Type Name Description
IConstructor constructor

The constructor into which the new parameter will be appended.

string parameterName

The name of the parameter.

Type parameterType

The type of the parameter.

TypedConstant defaultValue

The default value of the parameter (required). It must be type-compatible with parameterType. To specify default as the default value, use Default(IType).

Func<IParameter, IConstructor, PullAction> pullAction

An optional delegate that returns a PullAction specifying how to pull the new parameter from other child constructors. A null value is equivalent to None, i.e. defaultValue of the parameter will be used.

ImmutableArray<AttributeConstruction> attributes
Returns
Type Description
IIntroductionAdviceResult<IParameter>