Open sandboxFocus

Class StatementExtensions

Extension methods for the IStatement interface.

Inheritance
StatementExtensions
Namespace: Metalama.Framework.Code.SyntaxBuilders
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class StatementExtensions
Remarks

These extension methods provide convenient ways to convert statements to statement lists and to unwrap block statements. Use AsList(IStatement) when you need to pass a single statement to an API that expects an IStatementList, and UnwrapBlock(IStatement) when you need to extract the contents of a block statement.

Methods

Name Description
AsList(IStatement)

Wraps a given IStatement into a singleton IStatementList.

AsList(IEnumerable<IStatement>)

Wraps a list of IStatement into an IStatementList.

UnwrapBlock(IStatement)

Unwraps a block (i.e. remove its braces), if the statement is a block, and returns the resulting IStatementList.

See Also