Lean  $LEAN_TAG$
QuantConnect.Util.ExpressionBuilder Class Reference

Provides methods for constructing expressions at runtime More...

Static Public Member Functions

static LambdaExpression MakePropertyOrFieldSelector (Type type, string propertyOrField)
 Constructs a selector of the form: x => x.propertyOrField where x is an instance of 'type' More...
 
static Expression< Func< T, TProperty > > MakePropertyOrFieldSelector< T, TProperty > (string propertyOrField)
 Constructs a selector of the form: x => x.propertyOrField where x is an instance of 'type' More...
 
static Expression< Func< T, T, bool > > MakeBinaryComparisonLambda< T > (ExpressionType type)
 Constructs a lambda expression that accepts two parameters of type T and applies the specified binary comparison and returns the boolean result. More...
 
static bool IsBinaryComparison (this ExpressionType type)
 Determines whether or not the specified type is a binary comparison. More...
 
static IEnumerable< Expression > AsEnumerable (this Expression expression)
 Converts the specified expression into an enumerable of expressions by walking the expression tree More...
 
static IEnumerable< T > OfType< T > (this Expression expression)
 Returns all the expressions of the specified type in the given expression tree More...
 
static T Single< T > (this Expression expression)
 Returns the single expression of the specified type or throws if none or more than one expression of the specified type is contained within the expression. More...
 
static T Single< T > (this IEnumerable< Expression > expressions)
 Returns the single expression of the specified type or throws if none or more than one expression of the specified type is contained within the expression. More...
 

Detailed Description

Provides methods for constructing expressions at runtime

Definition at line 26 of file ExpressionBuilder.cs.

Member Function Documentation

◆ MakePropertyOrFieldSelector()

static LambdaExpression QuantConnect.Util.ExpressionBuilder.MakePropertyOrFieldSelector ( Type  type,
string  propertyOrField 
)
static

Constructs a selector of the form: x => x.propertyOrField where x is an instance of 'type'

Parameters
typeThe type of the parameter in the expression
propertyOrFieldThe name of the property or field to bind to
Returns
A new lambda expression that represents accessing the property or field on 'type'

Definition at line 34 of file ExpressionBuilder.cs.

Here is the caller graph for this function:

◆ MakePropertyOrFieldSelector< T, TProperty >()

static Expression<Func<T, TProperty> > QuantConnect.Util.ExpressionBuilder.MakePropertyOrFieldSelector< T, TProperty > ( string  propertyOrField)
static

Constructs a selector of the form: x => x.propertyOrField where x is an instance of 'type'

Template Parameters
TThe type of the parameter in the expression
TPropertyThe type of the property or field being accessed in the expression
Parameters
propertyOrFieldThe name of the property or field to bind to
Returns
A new lambda expression that represents accessing the property or field on 'type'

Definition at line 49 of file ExpressionBuilder.cs.

Here is the call graph for this function:

◆ MakeBinaryComparisonLambda< T >()

static Expression<Func<T, T, bool> > QuantConnect.Util.ExpressionBuilder.MakeBinaryComparisonLambda< T > ( ExpressionType  type)
static

Constructs a lambda expression that accepts two parameters of type T and applies the specified binary comparison and returns the boolean result.

Definition at line 58 of file ExpressionBuilder.cs.

◆ IsBinaryComparison()

static bool QuantConnect.Util.ExpressionBuilder.IsBinaryComparison ( this ExpressionType  type)
static

Determines whether or not the specified type is a binary comparison.

Definition at line 75 of file ExpressionBuilder.cs.

◆ AsEnumerable()

static IEnumerable<Expression> QuantConnect.Util.ExpressionBuilder.AsEnumerable ( this Expression  expression)
static

Converts the specified expression into an enumerable of expressions by walking the expression tree

Parameters
expressionThe expression to enumerate
Returns
An enumerable containing all expressions in the input expression

Definition at line 97 of file ExpressionBuilder.cs.

◆ OfType< T >()

static IEnumerable<T> QuantConnect.Util.ExpressionBuilder.OfType< T > ( this Expression  expression)
static

Returns all the expressions of the specified type in the given expression tree

Template Parameters
TThe type of expression to search for
Parameters
expressionThe expression to search
Returns
All expressions of the given type in the specified expression
Type Constraints
T :Expression 

Definition at line 110 of file ExpressionBuilder.cs.

◆ Single< T >() [1/2]

static T QuantConnect.Util.ExpressionBuilder.Single< T > ( this Expression  expression)
static

Returns the single expression of the specified type or throws if none or more than one expression of the specified type is contained within the expression.

Template Parameters
TThe type of expression to search for
Parameters
expressionThe expression to search
Returns
Expression of the specified type
Type Constraints
T :Expression 

Definition at line 123 of file ExpressionBuilder.cs.

◆ Single< T >() [2/2]

static T QuantConnect.Util.ExpressionBuilder.Single< T > ( this IEnumerable< Expression >  expressions)
static

Returns the single expression of the specified type or throws if none or more than one expression of the specified type is contained within the expression.

Template Parameters
TThe type of expression to search for
Parameters
expressionsThe expressions to search
Returns
Expression of the specified type
Type Constraints
T :Expression 

Definition at line 136 of file ExpressionBuilder.cs.


The documentation for this class was generated from the following file: