コード例 #1
0
        internal CodeUsingStatement Using(
            IEnumerable <CodeStatement> initializers,
            Action xlatUsingBody)
        {
            var u = new CodeUsingStatement();

            Scope.Add(u);
            u.Initializers.AddRange(initializers);
            var old = Scope;

            Scope = u.Statements;
            xlatUsingBody();
            Scope = old;
            return(u);
        }
コード例 #2
0
        public int VisitUsing(CodeUsingStatement u)
        {
            writer.Write("using");
            writer.Write(" (");
            writer.Write("var");
            writer.Write(" ");
            var  sep = "";
            bool old = suppressSemi;

            suppressSemi = true;
            foreach (var init in u.Initializers)
            {
                writer.Write(sep);
                sep = ", ";
                init.Accept(this);
            }
            suppressSemi = old;
            writer.Write(")");
            WriteStatements(u.Statements);
            writer.WriteLine();
            return(0);
        }