How to check if an expression is empty (void)?

Viewed 845

What is the best way to check if a System.Linq.Expressions.Expression instance is empty? For example, something like this:

Expression expression = Expression.Empty();
...
if (expression.IsEmpty) { ...

only that IsEmpty does not exist.

One idea is to test the outcome of ToString:

if (expression.ToString() == "default(Void)") { ...

but that doesn't seem right.

1 Answers
Related