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()); }
public static string ToCSharp(this BaseSyntax node, int tabSize = 4, string @namespace = null) => CSharpCodeGenerator.GenerateCSharp(node, tabSize, @namespace);