Expressions
An expression calculates a part of the result. This allows you to add and remove expressions when your requirements change easily.
Inline Expressions
Inline expressions are defined directly as lambda expressions:
Note that you cannot specify a method because a lambda expression is required.
The expression gets access to the question and the parameter.
If the question doesn't have a parameter then Missing.Value
is passed as the parameter.
Expression Classes
Normally, your expressions are a bit more complex and writing them directly into the solution definition is not feasible.
Therefore, you can pass an instance of a class implementing IExpression
instead of a lambda expression:
You get access to the question so that you can create different expressions based on information from the question.
The parameter is passed to the Evaluate
method on the expression:
Again, for parameter-less questions Missing
is used as the type of the paramter and Missing.Value
as the value.
The text you specify in the Describe
method is used when logging is enabled.