Parse lambda expressions from strings.
Object
Namespace: Radzen
Assembly: Radzen.Blazor.dll
public class ExpressionParserAllows expression strings to call the specified method. By default only methods of framework value types, Math, Convert and LINQ operators can be called.
public static void AllowMethod(Reflection.MethodInfo method)
| Type | Name | Description |
|---|---|---|
| Reflection.MethodInfo | method |
ExpressionParser.AllowMethod(typeof(Order).GetMethod(nameof(Order.IsOverdue))!);Allows expression strings to call the public methods and operators of the specified type and to read its static properties and fields.
public static void AllowType(Type type)
| Type | Name | Description |
|---|---|---|
| Type | type |
ExpressionParser.AllowType(typeof(MyApp.Filters.Helpers));Parses a lambda expression that returns a typed result.
public static Expressions.Expression<Func<T, TResult>> ParseLambda(string expression, Func<string, Type> typeResolver)
| Type | Name | Description |
|---|---|---|
| string | expression | |
| Func<string, Type> | typeResolver |
| Type | Description |
|---|---|
| Expressions.Expression<Func<T, TResult>> |
Parses a lambda expression that returns a typed result.
public static Expressions.LambdaExpression ParseLambda(string expression, Func<string, Type> typeLocator)
| Type | Name | Description |
|---|---|---|
| string | expression | |
| Func<string, Type> | typeLocator |
| Type | Description |
|---|---|
| Expressions.LambdaExpression |
Parses a lambda expression that returns a typed result.
public static Expressions.LambdaExpression ParseLambda(string expression, Type type, Func<string, Type> typeResolver)
| Type | Name | Description |
|---|---|---|
| string | expression | |
| Type | type | |
| Func<string, Type> | typeResolver |
| Type | Description |
|---|---|
| Expressions.LambdaExpression |
Parses a lambda expression that returns a boolean value.
public static Expressions.Expression<Func<T, bool>> ParsePredicate(string expression, Func<string, Type> typeResolver)
| Type | Name | Description |
|---|---|---|
| string | expression | |
| Func<string, Type> | typeResolver |
| Type | Description |
|---|---|
| Expressions.Expression<Func<T, bool>> |