, . ExpressionVisitor, node . , (, , ), NodeType .
:
static void HandlePrimitive(Expression e) {
Console.WriteLine(e.NodeType);
}
static void Process(Expression e) {
if (e.NodeType == ExpressionType.OrElse)
{
var be = e as BinaryExpression;
HandlePrimitive(be.Left);
Process(be.Right);
}
else HandlePrimitive(e);
}
Expression<Func<Product,bool>> f = a => a.ProductType == "tea" || a.Price <= 5;
Process(f.Body);
Process , "" ( "" ). HandlePrimitive , ||'s. These are other BinaryExpression values (e.g. Equal or LessThanEqual ). You'll need to look at their and Right`, , .. .