Exemple #1
0
        public SourceCode If(Expression e, SourceCode @then, SourceCode @else)
        {
            var n = new ConditionalStatement()
            {
                Expression = e,
                Then       = @then,
                Else       = @else
            };

            this.Add(n);

            return(this);
        }
        public static ConditionalStatement If(this SourceCode source, Expression test, SourceCode @then, SourceCode @else)
        {
            var n = new ConditionalStatement()
            {
                ConditionalExpression = test,
            };

            n.Then.Merge(@then);

            if (@else != null)
            {
                n.Else.Merge(@else);
            }

            source.Add(n);

            return(n);
        }