Metalama 1.0 / / Metalama Documentation / Aspect API Documentation / Metalama.​Framework.​Code.​Syntax­Builders / Expression­Factory

Class ExpressionFactory

Provides several ways to create instances of the IExpression interface.

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

Methods

Name Description
Capture(Object, out IExpression)

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 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 Byte to the StringBuilder.

Literal(Decimal, Boolean)

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

Literal(Double, Boolean)

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

Literal(Int16, Boolean)

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

Literal(Int32)

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

Literal(Int64, Boolean)

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

Literal(SByte, Boolean)

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

Literal(Single, Boolean)

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

Literal(String, Boolean)

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

Literal(UInt16, Boolean)

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

Literal(UInt32, Boolean)

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

Literal(UInt64, Boolean)

Returns an expression that represents a literal of type UInt64 to the 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.

ToExpression(IFieldOrProperty, IExpression)

Gets an IExpression that represents a given field or property.

ToExpression(IParameter)

Gets an IExpression that represents a given parameter.