Duplicate
I am generating a bunch of code and would like it's initial output (pre ctrl+K, Ctrl+D) to look reasonable. Managing indents is a royal pain and there has to be a utility or class out there I can embed inside of my code generator. I am embedding this into a VS add-in and in a build process so I am not interested in an external program. I need something I can call programatically.
Recommendations?
From stackoverflow
-
Use the IndentedTextWriter that is provided with the Microsoft .NET Framework to help with indenting code. There is sample usage included with the class documentation.
Noldorin : That's not going to be terribly useful without writing a parser to understand C# syntax and therefore decide when to indent/unindent.Atif Aziz : Right, I misunderstood the question.
0 comments:
Post a Comment