コード例 #1
0
        protected override void RefreshOverride()
        {
            var current  = default(TResult);
            var current2 = Source.Current;
            var flag     = false;

            foreach (var conditionalCase in _conditionalCases)
            {
                if (!conditionalCase.Evaluate(current2))
                {
                    continue;
                }
                current = conditionalCase.Return(current2);
                flag    = true;
                break;
            }
            if (!flag && _defaultCase != null)
            {
                current = _defaultCase.Return(current2);
            }
            Current = current;
        }
コード例 #2
0
        /// <summary>
        /// When overridden in a derived class, refreshes the operator.
        /// </summary>
        protected override void RefreshOverride()
        {
            var result = default(TResult);
            var source = Source.Current;

            var caseMatched = false;

            foreach (var conditionalCase in _conditionalCases)
            {
                if (conditionalCase.Evaluate(source))
                {
                    result      = conditionalCase.Return(source);
                    caseMatched = true;
                    break;
                }
            }

            if (!caseMatched && _defaultCase != null)
            {
                result = _defaultCase.Return(source);
            }

            Current = result;
        }