ExpressionParser Class

Parse lambda expressions from strings.

Inheritance

Object

ExpressionParser

Namespace: Radzen

Assembly: Radzen.Blazor.dll

Syntax

public class ExpressionParser

Methods

AllowMethodLink to this section

Allows expression strings to call the specified method. By default only methods of framework value types, Math, Convert and LINQ operators can be called.

Declaration
public static void AllowMethod(Reflection.MethodInfo method)
Parameters
Type Name Description
Reflection.MethodInfo method
Examples
ExpressionParser.AllowMethod(typeof(Order).GetMethod(nameof(Order.IsOverdue))!);

AllowTypeLink to this section

Allows expression strings to call the public methods and operators of the specified type and to read its static properties and fields.

Declaration
public static void AllowType(Type type)
Parameters
Type Name Description
Type type
Examples
ExpressionParser.AllowType(typeof(MyApp.Filters.Helpers));

ParseLambdaLink to this section

Parses a lambda expression that returns a typed result.

Declaration
public static Expressions.Expression<Func<T, TResult>> ParseLambda(string expression, Func<string, Type> typeResolver)
Parameters
Type Name Description
string expression
Func<string, Type> typeResolver
Returns
Type Description
Expressions.Expression<Func<T, TResult>>

ParseLambdaLink to this section

Parses a lambda expression that returns a typed result.

Declaration
public static Expressions.LambdaExpression ParseLambda(string expression, Func<string, Type> typeLocator)
Parameters
Type Name Description
string expression
Func<string, Type> typeLocator
Returns
Type Description
Expressions.LambdaExpression

ParseLambdaLink to this section

Parses a lambda expression that returns a typed result.

Declaration
public static Expressions.LambdaExpression ParseLambda(string expression, Type type, Func<string, Type> typeResolver)
Parameters
Type Name Description
string expression
Type type
Func<string, Type> typeResolver
Returns
Type Description
Expressions.LambdaExpression

ParsePredicateLink to this section

Parses a lambda expression that returns a boolean value.

Declaration
public static Expressions.Expression<Func<T, bool>> ParsePredicate(string expression, Func<string, Type> typeResolver)
Parameters
Type Name Description
string expression
Func<string, Type> typeResolver
Returns
Type Description
Expressions.Expression<Func<T, bool>>
In This Article
An error has occurred. This app may no longer respond until reloaded. Reload 🗙