Method When
- Namespace
- YndigoBlue.Velocity.Model
- Assembly
- YndigoBlue.Velocity.dll
When(IFilterItem, IElement)
Adds a branch to a searched case expression.
public Case When(IFilterItem condition, IElement result)
Parameters
conditionIFilterItemThe condition selecting this branch, such as a Criterion<T> or a nested Filter.
resultIElementThe value produced when the condition is true.
Returns
- Case
This case expression, for method chaining.
Remarks
Branches are evaluated in the order they are added and the first true condition wins, so add the most specific condition first.
Exceptions
- InvalidOperationException
Thrown when this is a simple case expression, which takes values rather than conditions.
When(IElement, IElement)
Adds a branch to a simple case expression.
public Case When(IElement value, IElement result)
Parameters
valueIElementThe value compared against the case expression's operand.
resultIElementThe value produced when the operand equals this branch value.
Returns
- Case
This case expression, for method chaining.
Remarks
Branches are evaluated in the order they are added and the first match wins, which is how ties between equal values are broken.
Exceptions
- InvalidOperationException
Thrown when this is a searched case expression, which takes conditions rather than values.