예제 #1
0
        public static string GenerateCSharp(BaseSyntax ast, int tabSize = 4, string @namespace = null)
        {
            var generator = new CSharpCodeGenerator {
                IndentSize = tabSize
            };

            if (!string.IsNullOrWhiteSpace(@namespace))
            {
                generator.Namespace = @namespace;
            }

            ast.Accept(generator);
            return(generator.Code.ToString());
        }
예제 #2
0
 public static string ToCSharp(this BaseSyntax node, int tabSize = 4, string @namespace = null) =>
 CSharpCodeGenerator.GenerateCSharp(node, tabSize, @namespace);