/// <summary> /// Returns true if this node evaluates to an empty string, /// otherwise false. /// It may be cheaper to determine whether an expression will evaluate /// to empty than to fully evaluate it. /// Implementations should cache the result so that calls after the first are free. /// </summary> internal override bool EvaluatesToEmpty(ConditionEvaluator.IConditionEvaluationState state) { if (_cachedExpandedValue == null) { if (_expandable) { string expandBreakEarly = state.ExpandIntoStringBreakEarly(_value); if (expandBreakEarly == null) { // It broke early: we can't store the value, we just // know it's non empty return false; } // It didn't break early, the result is accurate, // so store it so the work isn't done again. _cachedExpandedValue = expandBreakEarly; } else { _cachedExpandedValue = _value; } } return (_cachedExpandedValue.Length == 0); }