Creates instances of the IStatement interface.
Namespace: Metalama.Framework.Code.SyntaxBuilders
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class StatementFactory
Methods
Name | Description |
---|---|
Block(IStatementList) | Creates a block from an IStatementList. |
Block(params IStatement[]) | Creates a block composed of zero, one or many statements. |
Block(IEnumerable<IStatement>) | Creates a block composed of zero, one or many statements. |
FromExpression(IExpression) | Creates an expression statement (e.g. a method invocation or an assignment). |
FromTemplate(TemplateInvocation, object?) | Creates an IStatement obtained by invoking a template specified by a TemplateInvocation. |
FromTemplate(string, ITemplateProvider, object?) | Creates an IStatement obtained by invoking a template specified by its name, an ITemplateProvider, and optional arguments. |
FromTemplate(string, TemplateProvider, object?) | Creates an IStatement obtained by invoking a template specified by its name, a TemplateProvider, and optional arguments. |
FromTemplate(string, object?) | Creates an IStatement obtained by invoking a template specified by its name and optional arguments. |
List(params IStatement[]) | Creates an IStatementList from a list of IStatement. |
List(IEnumerable<IStatement>) | Creates an IStatementList from a list of IStatement. |
Parse(string) | Parses a string containing a C# statement and returns an IStatement, which can be inserted into the run-time code using InsertStatement(IStatement). The string must contain a single statement, and must be finished by a semicolon or a closing bracket. An alternative to this method is the StatementBuilder class. |
UnwrapBlock(IStatement) | Returns an IStatementList from the statements of a given block, or a singleton IStatementList containing the given statement itself if the statement is not a block. |