DateTimeConditionExpression

What it is

DateTimeConditionExpression is used to evaluate a DateTime property (of field or variable). Depending on the outcome, the result will then be either DateTime1 or DateTime2.

Code example

public DateTimeProperty DateTimeExample1 => DateTimeProperty(description: "first example");
public DateTimeProperty DateTimeExample2 => DateTimeProperty(description: "second example");

public ReadOnlyDateTimeProperty DateTimeResult
{
    get
    {
        return CalculatedDateTimeProperty(() => 
            DateTimeExample1.IsEqualTo(DateTimeExample2).IsTrueElse(DateTimeExample1, DateTimeExample2));
    }  
}

 

Explanation of the example

Line 9 evaluates if DateTimeExample1 is equal to DateTimeExample2.
If so, DateTimeExample1 will be assigned to the CalculatedDateTimeProperty DateTimeResult, otherwise DateTimeExample2 will be assigned to DateTimeResult.