Open sandboxFocus

Class SyntaxBuilder

Base class for ExpressionBuilder and StatementBuilder, providing common methods for building C# syntax programmatically.

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

SyntaxBuilder provides the core functionality for building C# code as text through an underlying StringBuilder. It offers specialized methods for appending different syntax elements:

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()

Extension Methods

See Also