Expression.Add Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Erstellt eine BinaryExpression , die einen arithmetischen Additionsvorgang darstellt, der keine Überlaufüberprüfung hat.
Überlädt
| Name | Beschreibung |
|---|---|
| Add(Expression, Expression) |
Erstellt eine BinaryExpression , die einen arithmetischen Additionsvorgang darstellt, der keine Überlaufüberprüfung hat. |
| Add(Expression, Expression, MethodInfo) |
Erstellt eine BinaryExpression , die einen arithmetischen Additionsvorgang darstellt, der keine Überlaufüberprüfung hat. Die Implementierungsmethode kann angegeben werden. |
Add(Expression, Expression)
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
Erstellt eine BinaryExpression , die einen arithmetischen Additionsvorgang darstellt, der keine Überlaufüberprüfung hat.
public:
static System::Linq::Expressions::BinaryExpression ^ Add(System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right);
public static System.Linq.Expressions.BinaryExpression Add(System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right);
static member Add : System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.BinaryExpression
Public Shared Function Add (left As Expression, right As Expression) As BinaryExpression
Parameter
- left
- Expression
A Expression , um die Left Eigenschaft gleich festzulegen.
- right
- Expression
A Expression , um die Right Eigenschaft gleich festzulegen.
Gibt zurück
A BinaryExpression that has the NodeType property equal to Add and the LeftRight properties set to the specified values.
Ausnahmen
left oder right ist null.
Der Additionsoperator ist nicht für left. Typ und right. Typ.
Beispiele
Das folgende Codebeispiel zeigt, wie Sie einen Ausdruck erstellen, der zwei ganze Zahlen hinzufügt.
// Add the following directive to your file:
// using System.Linq.Expressions;
// This expression adds the values of its two arguments.
// Both arguments must be of the same type.
Expression sumExpr = Expression.Add(
Expression.Constant(1),
Expression.Constant(2)
);
// Print out the expression.
Console.WriteLine(sumExpr.ToString());
// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda<Func<int>>(sumExpr).Compile()());
// This code example produces the following output:
//
// (1 + 2)
// 3
' Add the following directive to your file:
' Imports System.Linq.Expressions
' This expression adds the values of its two arguments.
' Both arguments must be of the same type.
Dim sumExpr As Expression = Expression.Add(
Expression.Constant(1),
Expression.Constant(2)
)
' Print the expression.
Console.WriteLine(sumExpr.ToString())
' The following statement first creates an expression tree,
' then compiles it, and then executes it.
Console.WriteLine(Expression.Lambda(Of Func(Of Integer))(sumExpr).Compile()())
' This code example produces the following output:
'
' (1 + 2)
' 3
Hinweise
Weitere Informationen zu dieser API finden Sie in den ergänzenden API-Hinweisen für Expression.Add.
Gilt für:
Add(Expression, Expression, MethodInfo)
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
- Quelle:
- BinaryExpression.cs
Erstellt eine BinaryExpression , die einen arithmetischen Additionsvorgang darstellt, der keine Überlaufüberprüfung hat. Die Implementierungsmethode kann angegeben werden.
public:
static System::Linq::Expressions::BinaryExpression ^ Add(System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right, System::Reflection::MethodInfo ^ method);
public static System.Linq.Expressions.BinaryExpression Add(System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, System.Reflection.MethodInfo method);
public static System.Linq.Expressions.BinaryExpression Add(System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, System.Reflection.MethodInfo? method);
static member Add : System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Reflection.MethodInfo -> System.Linq.Expressions.BinaryExpression
Public Shared Function Add (left As Expression, right As Expression, method As MethodInfo) As BinaryExpression
Parameter
- left
- Expression
A Expression , um die Left Eigenschaft gleich festzulegen.
- right
- Expression
A Expression , um die Right Eigenschaft gleich festzulegen.
- method
- MethodInfo
A MethodInfo , um die Method Eigenschaft gleich festzulegen.
Gibt zurück
Ein BinaryExpression Wert, der die NodeType Eigenschaft gleich Add und den Eigenschaften Left aufweist, die RightMethod auf die angegebenen Werte festgelegt sind.
Ausnahmen
left oder right ist null.
method ist nicht null und die methode, die sie darstellt void, ist nicht static (Shared in Visual Basic) oder verwendet nicht genau zwei Argumente.
method ist null und der Additionsoperator nicht für left. Typ und right. Typ.
Hinweise
Weitere Informationen zu dieser API finden Sie in den ergänzenden API-Hinweisen für Expression.Add.