public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(Type ^ delegateType, System::Linq::Expressions::Expression ^ body, System::String ^ name, bool tailCall, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, string name, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, string? name, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : Type * System.Linq.Expressions.Expression * string * bool * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (delegateType As Type, body As Expression, name As String, tailCall As Boolean, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(Type ^ delegateType, System::Linq::Expressions::Expression ^ body, System::String ^ name, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, string name, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, string? name, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : Type * System.Linq.Expressions.Expression * string * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (delegateType As Type, body As Expression, name As String, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(Type ^ delegateType, System::Linq::Expressions::Expression ^ body, bool tailCall, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : Type * System.Linq.Expressions.Expression * bool * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (delegateType As Type, body As Expression, tailCall As Boolean, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(System::Linq::Expressions::Expression ^ body, System::String ^ name, bool tailCall, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, string name, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, string? name, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * string * bool * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (body As Expression, name As String, tailCall As Boolean, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(Type ^ delegateType, System::Linq::Expressions::Expression ^ body, ... cli::array <System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, params System.Linq.Expressions.ParameterExpression[] parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, params System.Linq.Expressions.ParameterExpression[]? parameters);
static member Lambda : Type * System.Linq.Expressions.Expression * System.Linq.Expressions.ParameterExpression[] -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (delegateType As Type, body As Expression, ParamArray parameters As ParameterExpression()) As LambdaExpression
body
.Type 表示的類型無法指派給
delegateType
所表示之委派類型的傳回類型。
parameters
包含的項目數與
delegateType
所表示之委派類型的參數清單不同。
parameters
之項目的
Type
屬性無法從由
delegateType
所表示之委派類型的對應參數類型指派。
從這個函式傳回的物件的類型為
Expression<TDelegate>
。 類型
LambdaExpression
是用來表示傳回的物件,因為 Lambda 運算式的具象型別在編譯時期不知道。
所
delegateType
表示之委派型別的參數數目必須等於 的
parameters
長度。
parameters
的專案必須等於 中的
body
參數運算式。
Type
結果物件的 屬性等於
delegateType
。 如果
parameters
為
null
,
Parameters
則產生的 物件屬性是空的集合。
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(Type ^ delegateType, System::Linq::Expressions::Expression ^ body, bool tailCall, ... cli::array <System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, bool tailCall, params System.Linq.Expressions.ParameterExpression[] parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, bool tailCall, params System.Linq.Expressions.ParameterExpression[]? parameters);
static member Lambda : Type * System.Linq.Expressions.Expression * bool * System.Linq.Expressions.ParameterExpression[] -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (delegateType As Type, body As Expression, tailCall As Boolean, ParamArray parameters As ParameterExpression()) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(System::Linq::Expressions::Expression ^ body, System::String ^ name, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, string name, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, string? name, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * string * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (body As Expression, name As String, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(System::Linq::Expressions::Expression ^ body, bool tailCall, ... cli::array <System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, bool tailCall, params System.Linq.Expressions.ParameterExpression[] parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, bool tailCall, params System.Linq.Expressions.ParameterExpression[]? parameters);
static member Lambda : System.Linq.Expressions.Expression * bool * System.Linq.Expressions.ParameterExpression[] -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (body As Expression, tailCall As Boolean, ParamArray parameters As ParameterExpression()) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(System::Linq::Expressions::Expression ^ body, bool tailCall, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * bool * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (body As Expression, tailCall As Boolean, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(Type ^ delegateType, System::Linq::Expressions::Expression ^ body, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (Type delegateType, System.Linq.Expressions.Expression body, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : Type * System.Linq.Expressions.Expression * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (delegateType As Type, body As Expression, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
body
.Type 表示的類型無法指派給
delegateType
所表示之委派類型的傳回類型。
parameters
包含的項目數與
delegateType
所表示之委派類型的參數清單不同。
parameters
之項目的
Type
屬性無法從由
delegateType
所表示之委派類型的對應參數類型指派。
下列範例示範如何建立運算式,代表將 1 加入至傳遞引數的 Lambda 運算式。
// Add the following directive to your file:
// using System.Linq.Expressions;
// A parameter for the lambda expression.
ParameterExpression paramExpr = Expression.Parameter(typeof(int), "arg");
// This expression represents a lambda expression
// that adds 1 to the parameter value.
LambdaExpression lambdaExpr = Expression.Lambda(
Expression.Add(
paramExpr,
Expression.Constant(1)
new List<ParameterExpression>() { paramExpr }
// Print out the expression.
Console.WriteLine(lambdaExpr);
// Compile and run the lamda expression.
// The value of the parameter is 1.
Console.WriteLine(lambdaExpr.Compile().DynamicInvoke(1));
// This code example produces the following output:
// arg => (arg +1)
' Add the following directive to your file:
' Imports System.Linq.Expressions
' A parameter for the lambda expression.
Dim paramExpr As ParameterExpression = Expression.Parameter(GetType(Integer), "arg")
' This expression represents a lambda expression
' that adds 1 to the parameter value.
Dim lambdaExpr As LambdaExpression = Expression.Lambda(
Expression.Add(
paramExpr,
Expression.Constant(1)
New List(Of ParameterExpression)() From {paramExpr}
' Print out the expression.
Console.WriteLine(lambdaExpr)
' Compile and run the lamda expression.
' The value of the parameter is 1.
Console.WriteLine(lambdaExpr.Compile().DynamicInvoke(1))
' This code example produces the following output:
' arg => (arg +1)
從這個函式傳回的物件的類型為
Expression<TDelegate>
。 類型
LambdaExpression
是用來表示傳回的物件,因為 Lambda 運算式的具象型別在編譯時期不知道。
所
delegateType
表示之委派型別的參數數目必須等於 的
parameters
長度。
parameters
的專案必須等於 中的
body
參數運算式。
Type
結果物件的 屬性等於
delegateType
。 如果
parameters
為
null
,
Parameters
則產生的 物件屬性是空的集合。
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(System::Linq::Expressions::Expression ^ body, ... cli::array <System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, params System.Linq.Expressions.ParameterExpression[] parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, params System.Linq.Expressions.ParameterExpression[]? parameters);
static member Lambda : System.Linq.Expressions.Expression * System.Linq.Expressions.ParameterExpression[] -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (body As Expression, ParamArray parameters As ParameterExpression()) As LambdaExpression
public:
static System::Linq::Expressions::LambdaExpression ^ Lambda(System::Linq::Expressions::Expression ^ body, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.LambdaExpression Lambda (System.Linq.Expressions.Expression body, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.LambdaExpression
Public Shared Function Lambda (body As Expression, parameters As IEnumerable(Of ParameterExpression)) As LambdaExpression
public:
generic <typename TDelegate>
static System::Linq::Expressions::Expression<TDelegate> ^ Lambda(System::Linq::Expressions::Expression ^ body, System::String ^ name, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, string name, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, string? name, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * string * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.Expression<'Delegate>
Public Shared Function Lambda(Of TDelegate) (body As Expression, name As String, parameters As IEnumerable(Of ParameterExpression)) As Expression(Of TDelegate)
TDelegate
public:
generic <typename TDelegate>
static System::Linq::Expressions::Expression<TDelegate> ^ Lambda(System::Linq::Expressions::Expression ^ body, bool tailCall, ... cli::array <System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, bool tailCall, params System.Linq.Expressions.ParameterExpression[] parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, bool tailCall, params System.Linq.Expressions.ParameterExpression[]? parameters);
static member Lambda : System.Linq.Expressions.Expression * bool * System.Linq.Expressions.ParameterExpression[] -> System.Linq.Expressions.Expression<'Delegate>
Public Shared Function Lambda(Of TDelegate) (body As Expression, tailCall As Boolean, ParamArray parameters As ParameterExpression()) As Expression(Of TDelegate)
TDelegate
public:
generic <typename TDelegate>
static System::Linq::Expressions::Expression<TDelegate> ^ Lambda(System::Linq::Expressions::Expression ^ body, System::String ^ name, bool tailCall, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, string name, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, string? name, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * string * bool * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.Expression<'Delegate>
Public Shared Function Lambda(Of TDelegate) (body As Expression, name As String, tailCall As Boolean, parameters As IEnumerable(Of ParameterExpression)) As Expression(Of TDelegate)
TDelegate
public:
generic <typename TDelegate>
static System::Linq::Expressions::Expression<TDelegate> ^ Lambda(System::Linq::Expressions::Expression ^ body, ... cli::array <System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, params System.Linq.Expressions.ParameterExpression[] parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, params System.Linq.Expressions.ParameterExpression[]? parameters);
static member Lambda : System.Linq.Expressions.Expression * System.Linq.Expressions.ParameterExpression[] -> System.Linq.Expressions.Expression<'Delegate>
Public Shared Function Lambda(Of TDelegate) (body As Expression, ParamArray parameters As ParameterExpression()) As Expression(Of TDelegate)
TDelegate
public:
generic <typename TDelegate>
static System::Linq::Expressions::Expression<TDelegate> ^ Lambda(System::Linq::Expressions::Expression ^ body, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.Expression<'Delegate>
Public Shared Function Lambda(Of TDelegate) (body As Expression, parameters As IEnumerable(Of ParameterExpression)) As Expression(Of TDelegate)
TDelegate
public:
generic <typename TDelegate>
static System::Linq::Expressions::Expression<TDelegate> ^ Lambda(System::Linq::Expressions::Expression ^ body, bool tailCall, System::Collections::Generic::IEnumerable<System::Linq::Expressions::ParameterExpression ^> ^ parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters);
public static System.Linq.Expressions.Expression<TDelegate> Lambda<TDelegate> (System.Linq.Expressions.Expression body, bool tailCall, System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression>? parameters);
static member Lambda : System.Linq.Expressions.Expression * bool * seq<System.Linq.Expressions.ParameterExpression> -> System.Linq.Expressions.Expression<'Delegate>
Public Shared Function Lambda(Of TDelegate) (body As Expression, tailCall As Boolean, parameters As IEnumerable(Of ParameterExpression)) As Expression(Of TDelegate)
TDelegate