Esempio n. 1
0
        /// <summary>
        ///   Conditional constructor for the initial if condition.
        /// </summary>
        /// <param name="condition">
        ///   A function with <see cref="bool" /> return type used to determine if a statement satisfies a
        ///   condition. This is the initial if statement.
        /// </param>
        /// <param name="method">
        ///   The action to invoke if <paramref name="condition" /> results in a <see langword="true" /> value
        /// </param>
        public Conditional([NotNull] Func <bool> condition, [NotNull] Action method)
        {
            if (condition is null)
            {
                throw new ArgumentNullException(nameof(condition));
            }

            if (method is null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            IfCondition = new ConditionalIf(condition, method);
        }
Esempio n. 2
0
        internal void AddElseIf(Func <bool> condition, Action method)
        {
            if (method is null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            if (ElseIf is null)
            {
                ElseIf = new ConditionalIf(condition, method);
            }
            else
            {
                ElseIf.AddElseIf(condition, method);
            }
        }