All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

CriteriaOperator.FromLambda<TModel, TResult>(Expression<Func<TModel, TResult>>) Method

Converts the specified LINQ-like expression to its CriteriaOperator equivalent.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v21.1.dll

Declaration

public static CriteriaOperator FromLambda<TModel, TResult>(
    Expression<Func<TModel, TResult>> lambda
)

Parameters

Name Type Description
lambda Expression<Func<TModel, TResult>>

A LINQ expression to convert.

Type Parameters

Name Description
TModel

A type of object to which the expression is applied.

TResult

A type of object that is returned by the converted expression.

Returns

Type Description
CriteriaOperator

A CriteriaOperator equivalent to the expression passed to the method’s parameter.

Remarks

Use the FromLambda method to create a criteria operator from a LINQ-like predicate expression:

// Returns "[Name]"
CriteriaOperator stringCriteria = CriteriaOperator.FromLambda<User,string>(u => u.Name);
// Returns "[Departments].Single()"
CriteriaOperator classCriteria = CriteriaOperator.FromLambda<User, Department>(u => u.Departments.SingleOrDefault());

Tip

For information on how to build LINQ-like expressions, refer to the following topic: LINQ-Like Criteria Syntax

See Also