Пример #1
0
        /// <summary>
        /// Prepares for the excution of a Try/Catch action, this requires the call to one of the following actions eventually: Catch, Swallow, SwalloIf.
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public static ITriableAction Try(Action action)
        {
            var instance = new Flux {
                Action = action
            };

            return(instance);
        }
Пример #2
0
        /// <summary>
        /// Prepare for the excution of IF statement, requires the call to Then eventually.
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static IConditionBuilder If(Func <bool> condition)
        {
            var instance = new Flux {
                ConditionValue = condition
            };

            return(instance);
        }
Пример #3
0
        /// <summary>
        /// Prepare for the excution of a Do-While statement using the specified condition, this requires the call to While eventually.
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public static ILateLoopBuilder Do(Action action)
        {
            var instance = new Flux {
                Action = action
            };

            return(instance);
        }
Пример #4
0
        /// <summary>
        /// Prepare for the excution of a while statement using the specified condition, this requires the call to Do eventually.
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static IEarlyLoopBuilder While(Func <bool> condition)
        {
            var instance = new Flux {
                ConditionValue = condition
            };

            return(instance);
        }
Пример #5
0
        /// <summary>
        /// Prepares for a switch statement over the specified type T, this requires the call to Default eventually.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static ISwitchTypeBuilder Switch <T>()
        {
            var instance = new Flux
            {
                SwitchCases       = new List <CaseInfo>(),
                SwitchMainOperand = typeof(T)
            };

            return(instance);
        }
Пример #6
0
        /// <summary>
        /// Prepares for a switch statement over the specified mainOperand, this requires the call to Default eventually.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="main_operand"></param>
        /// <returns></returns>
        public static ISwitchBuilder Switch <T>(T main_operand)
        {
            var instance = new Flux
            {
                SwitchCases       = new List <CaseInfo>(),
                SwitchMainOperand = main_operand
            };

            return(instance);
        }
Пример #7
0
        /// <summary>
        /// Performs a while control using the evaluation condition for the specified action.
        /// While condition, Do action
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static IAction While(Func <bool> condition, Action action)
        {
            var instance = new Flux();

            while (condition())
            {
                action();
            }
            return(instance);
        }