如果表达式是 a ,您更喜欢用哪一个来测试ConstantExpression
?从NodeType
属性还是演员,为什么?
public static bool IsConstantExpression(Expression expression)
{
return expression.NodeType == ExpressionType.Constant;
return expression is ConstantExpression;
}