Пример #1
0
        public static SwitchCSharpStatement Switch(Expression switchValue, LabelTarget breakLabel, Expression defaultBody, IEnumerable <CSharpSwitchCase> cases)
        {
            if (defaultBody != null)
            {
                var @default = new[] { CSharpStatement.SwitchCaseDefault(defaultBody) };

                if (cases != null)
                {
                    cases = cases.Concat(@default);
                }
                else
                {
                    cases = @default;
                }
            }

            return(Switch(switchValue, breakLabel, default(IEnumerable <ParameterExpression>), cases));
        }
        public static SwitchCSharpStatement Switch(Expression switchValue, LabelTarget breakLabel, Expression defaultBody, IEnumerable <CSharpSwitchCase> cases)
        {
            if (defaultBody != null)
            {
                // NB: No check for DefaultBody to be of type void; we'll make it void in Reduce if need be.

                var @default = new[] { CSharpStatement.SwitchCaseDefault(defaultBody) };

                if (cases != null)
                {
                    cases = cases.Concat(@default);
                }
                else
                {
                    cases = @default;
                }
            }

            return(Switch(switchValue, breakLabel, default(IEnumerable <ParameterExpression>), cases));
        }