public void Write(TextWriter writer) { var decompiler = new AstBuilder(new DecompilerContext(assemblyDefinition.MainModule)); decompiler.AddAssembly(assemblyDefinition); var formattingPolicy = FormattingOptionsFactory.CreateMono().Clone(); IAstVisitor [] visitors = { new PublicApiVisitor(), new SortTreeVisitor(), new CSharpOutputVisitor(TokenWriter.Create(writer,indentation: " "), formattingPolicy) }; foreach (var visitor in visitors) { decompiler.SyntaxTree.AcceptVisitor(visitor); } foreach (var tool in visitorTools) { decompiler.SyntaxTree.AcceptVisitor(tool.Visitor); } writer.Flush(); }