Open sandboxFocus

Method AddCase

AddCase(SwitchStatementLabel, IStatementList, bool)

Add a case switch section. This overload accepts an IStatementList.

Declaration
public void AddCase(SwitchStatementLabel label, IStatementList statements, bool appendBreak = true)
Parameters
Type Name Description
SwitchStatementLabel label

The label, i.e. the value to match.

IStatementList statements

The statements to execute.

bool appendBreak

Value indicating whether a break; statement should be appended to statements. The default value is true.

AddCase(SwitchStatementLabel, IStatement, bool)

Add a case switch section. This overload accepts an IStatement.

Declaration
public void AddCase(SwitchStatementLabel label, IStatement statement, bool appendBreak = true)
Parameters
Type Name Description
SwitchStatementLabel label

The label, i.e. the value to match.

IStatement statement

The statement to execute. To call a template, see FromTemplate(TemplateInvocation, object?).

bool appendBreak

Value indicating whether a break; statement should be appended to statement. The default value is true.

AddCase(SwitchStatementLabel, IExpression?, IStatementList, bool)

Add a case switch section with a when expression. This overload accepts an IStatementList.

Declaration
public void AddCase(SwitchStatementLabel label, IExpression? when, IStatementList statements, bool appendBreak = true)
Parameters
Type Name Description
SwitchStatementLabel label

The label, i.e. the value to match.

IExpression when

The when expression.

IStatementList statements

The statements to execute.

bool appendBreak

Value indicating whether a break; statement should be appended to statements. The value is true.

AddCase(SwitchStatementLabel, IExpression?, IStatement, bool)

Add a case switch section with a when expression. This overload accepts an IStatement.

Declaration
public void AddCase(SwitchStatementLabel label, IExpression? when, IStatement statement, bool appendBreak = true)
Parameters
Type Name Description
SwitchStatementLabel label

The label, i.e. the value to match.

IExpression when

The when expression.

IStatement statement

The statement to execute. To call a template, see FromTemplate(TemplateInvocation, object?).

bool appendBreak

Value indicating whether a break; statement should be appended to statement. The value is true.