本文整理汇总了C#中BinaryOperatorExpression.Evaluate方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryOperatorExpression.Evaluate方法的具体用法?C# BinaryOperatorExpression.Evaluate怎么用?C# BinaryOperatorExpression.Evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryOperatorExpression
的用法示例。
在下文中一共展示了BinaryOperatorExpression.Evaluate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluateDivideToFloatExpression
public void EvaluateDivideToFloatExpression()
{
BinaryExpression expression = new BinaryOperatorExpression(new ConstantExpression(4), new ConstantExpression(5), BinaryOperator.Divide);
Assert.IsNotNull(expression);
Assert.IsNotNull(expression.Left);
Assert.IsNotNull(expression.Right);
Assert.AreEqual(0.8, expression.Evaluate(new BindingEnvironment()));
}
示例2: EvaluateMultiplyExpressionWithLeftString
public void EvaluateMultiplyExpressionWithLeftString()
{
BinaryExpression expression = new BinaryOperatorExpression(new ConstantExpression("spam"), new ConstantExpression(3), BinaryOperator.Multiply);
Assert.IsNotNull(expression);
Assert.IsNotNull(expression.Left);
Assert.IsNotNull(expression.Right);
Assert.AreEqual("spamspamspam", expression.Evaluate(new BindingEnvironment()));
}
示例3: EvaluateAddExpression
public void EvaluateAddExpression()
{
BinaryExpression expression = new BinaryOperatorExpression(new ConstantExpression(1), new ConstantExpression(2), BinaryOperator.Add);
Assert.IsNotNull(expression);
Assert.IsNotNull(expression.Left);
Assert.IsNotNull(expression.Right);
Assert.AreEqual(3, expression.Evaluate(new BindingEnvironment()));
}