MetalamaAPI documentationAspect APIMetalama.​Framework.​Code.​Syntax­BuildersExpression­Factory
Open sandboxFocus

ExpressionFactory Class

Provides several ways to create instances of the IExpression interface.

Inheritance
System.Object
ExpressionFactory
Namespace: Metalama.Framework.Code.SyntaxBuilders
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class ExpressionFactory : Object

Methods

Name Description
Capture(Object)

Creates a compile-time object that represents a run-time expression, i.e. the syntax or code, and not the result itself. The returned IExpression can then be used in run-time C# code thanks to the Value property. This mechanism allows to generate expressions that depend on a compile-time control flow.

CastTo(IExpression, IType)

Returns an expression obtained by casting another expression to a type given as an IType.

CastTo(IExpression, Type)

Returns an expression obtained by casting another expression to a type given as a System.Type.

CastTo<T>(IExpression)

Returns an expression obtained by casting another expression to a type given as a generic parameter.

Literal(Byte, Boolean)

Returns an expression that represents a literal of type System.Byte to the System.Text.StringBuilder.

Literal(Decimal, Boolean)

Returns an expression that represents a literal of type System.Decimal to the System.Text.StringBuilder.

Literal(Double, Boolean)

Returns an expression that represents a literal of type System.Double to the System.Text.StringBuilder.

Literal(Int16, Boolean)

Returns an expression that represents a literal of type System.Int16 to the System.Text.StringBuilder.

Literal(Int32)

Returns an expression that represents a literal of type System.Int32 to the System.Text.StringBuilder.

Literal(Int64, Boolean)

Returns an expression that represents a literal of type System.Int64 to the System.Text.StringBuilder.

Literal(SByte, Boolean)

Returns an expression that represents a literal of type System.SByte to the System.Text.StringBuilder.

Literal(Single, Boolean)

Returns an expression that represents a literal of type System.Single to the System.Text.StringBuilder.

Literal(String, Boolean)

Returns an expression that represents a literal of type System.String to the System.Text.StringBuilder.

Literal(UInt16, Boolean)

Returns an expression that represents a literal of type System.UInt16 to the System.Text.StringBuilder.

Literal(UInt32, Boolean)

Returns an expression that represents a literal of type System.UInt32 to the System.Text.StringBuilder.

Literal(UInt64, Boolean)

Returns an expression that represents a literal of type System.UInt64 to the System.Text.StringBuilder.

Parse(String)

Parses a string containing a C# expression and returns an IExpression. The Value property allows to use this expression in a template. An alternative to this method is the ExpressionBuilder class.

This(INamedType)

Gets a this expression for the given type.