Open sandboxFocus

Interface IStatement

A compile-time representation of a run-time statement that can be inserted into generated code.

Namespace: Metalama.Framework.Code.SyntaxBuilders
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
[InternalImplement]
public interface IStatement
Remarks

In Metalama templates, IStatement objects are compile-time representations of C# statements that will be inserted into the transformed code. Unlike IExpression which represents values and can be used within expressions, statements represent complete actions that are inserted as separate lines of code using InsertStatement(IStatement).

To create statements, use StatementFactory for common scenarios (parsing strings, creating blocks, invoking templates), StatementBuilder for programmatic construction with proper indentation support, or SwitchStatementBuilder for building switch statements.

Extension Methods

See Also