Base class for ExpressionBuilder and StatementBuilder, providing common methods for building C# syntax programmatically.
Namespace: Metalama.Framework.Code.SyntaxBuilders
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public abstract class SyntaxBuilderRemarks
SyntaxBuilder provides the core functionality for building C# code as text through an underlying StringBuilder. It offers specialized methods for appending different syntax elements:
- AppendLiteral(int) and overloads - Append literal values with proper C# syntax
- AppendTypeName(IType) - Append fully-qualified type names
- AppendExpression(IExpression) - Append existing expressions
- AppendVerbatim(string) - Append raw text for keywords, operators, and punctuation
Derived classes ExpressionBuilder and StatementBuilder provide additional functionality specific to building expressions and statements respectively.
Methods
| Name | Description |
|---|---|
| AppendExpression(IExpression) | Appends an expression to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder, where the expression is given as an IExpression. |
| AppendExpression(IExpressionBuilder) | Appends an expression to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder, where the expression is given as an IExpressionBuilder. |
| AppendExpression(dynamic?) | Appends an expression to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder, where the expression is a C# expression. |
| AppendLiteral(byte, bool) | Appends a literal of type byte to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(decimal, bool) | Appends a literal of type decimal to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(double, bool) | Appends a literal of type double to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(short, bool) | Appends a literal of type short to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(int) | Appends a literal of type int to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(long, bool) | Appends a literal of type long to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(sbyte, bool) | Appends a literal of type sbyte to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(float, bool) | Appends a literal of type float to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(string?, bool) | Appends a literal of type string to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(ushort, bool) | Appends a literal of type ushort to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(uint, bool) | Appends a literal of type uint to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendLiteral(ulong, bool) | Appends a literal of type ulong to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder. |
| AppendTypeName(IType) | Appends a fully-qualified type name to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder, where the type is given as an IType. |
| AppendTypeName(Type) | Appends a fully-qualified type name to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder, where the type is given as a reflection Type. |
| AppendVerbatim(string) | Appends a string to the Metalama.Framework.Code.SyntaxBuilders.SyntaxBuilder.StringBuilder, without performing any modification to the input string. |
| ToString() |