Open sandboxFocus

Method AddInitializerArgument

AddInitializerArgument(IExpression, string?)

Adds an argument to the constructor initializer (base or this call).

Declaration
void AddInitializerArgument(IExpression initializerArgumentExpression, string? parameterName = null)
Parameters
Type Name Description
IExpression initializerArgumentExpression

The expression to pass as an argument to the constructor initializer.

string parameterName

The optional name of the parameter to which the argument should be assigned. If null, arguments are assigned positionally.

Remarks

This method is commonly used when introducing constructor parameters to pass the new parameter value to base or chained constructors via the : base(...) or : this(...) syntax.

See Also