public static Expression<Func<int, int, int>> CreateExpressionTreeLambdaExpression()
{
return (x, y) => x * y;
}
So I understand that if I wanted to test this method I could do like so, which evaluates to true.
[TestMethod]
public void TestLambdaExpressions_ExpressionTreeLambdaExpression()
{
var expression = MultiplyDelegate.CreateExpressionTreeLambdaExpression();
var function = expression.Compile();
Assert.AreEqual(6, function(2, 3));
}
What I don't seem to grasp is the three int's inside the Expression. Where is the third int being used? Is this some sort of reference to itself?
The two parameters are int
s and the result is an int
. That makes three int
s.