Open sandboxFocus

Method Block

Block(params IStatement[])

Creates a block statement (enclosed in braces) containing zero, one, or many statements.

Declaration
public static IStatement Block(params IStatement[] statements)
Parameters
Type Name Description
IStatement[] statements

The statements to include in the block.

Returns
Type Description
IStatement

An IStatement representing a block with the specified statements.

Remarks

Blocks are useful for grouping multiple statements together, such as in control flow structures or when a single statement is expected but you need to execute multiple operations. The generated code will include the opening and closing braces.

Block(IEnumerable<IStatement>)

Creates a block composed of zero, one or many statements.

Declaration
public static IStatement Block(IEnumerable<IStatement> statements)
Parameters
Type Name Description
IEnumerable<IStatement> statements
Returns
Type Description
IStatement

Block(IStatementList)

Creates a block from an IStatementList.

Declaration
public static IStatement Block(IStatementList list)
Parameters
Type Name Description
IStatementList list
Returns
Type Description
IStatement