System.Linq.Expressions.Expression.Lambda Method

Creates a System.Linq.Expressions.LambdaExpression by first constructing a delegate type.

Syntax

public static LambdaExpression Lambda (Expression body, params ParameterExpression[] parameters)

Parameters

body
An System.Linq.Expressions.Expression to set the LambdaExpression.Body property equal to.
parameters
An array of System.Linq.Expressions.ParameterExpression objects to use to populate the LambdaExpression.Parameters collection.

Returns

A System.Linq.Expressions.LambdaExpression that has the Expression.NodeType property equal to ExpressionType.Lambda and the LambdaExpression.Body and LambdaExpression.Parameters properties set to the specified values.

Remarks

The parameters parameter must not have more than sixteen elements.

The elements of parameters must be reference equal to the parameter expressions in body.

This method constructs an appropriate delegate type from one of the System.Func generic delegates. It then passes the delegate type to one of the ExpressionType.Lambda factory methods to create a System.Linq.Expressions.LambdaExpression.

Requirements

Namespace: System.Linq.Expressions
Assembly: System.Core (in System.Core.dll)
Assembly Versions: 3.5.0.0, 4.0.0.0