Skip to main content

Expression tree checkpoint

Challenge on lesson: Checkpoint: expression trees

CHALLENGE
Difficulty: advanced+25 XP

Implement static Expression<Func<int, bool>> BuildPredicate(int threshold) returning an expression equivalent to x => x >= threshold && x % 2 == 0 (built programmatically, capturing threshold). Then implement static string Describe(Expression<Func<int, bool>> e) that returns the expression's NodeType of its body (e.g. "AndAlso").

Back to lesson: Checkpoint: expression trees