[Question] IndentedStringBuilder AppendLine(string text) does not add carriage return.
workgroupengineering opened this issue · 4 comments
is it intentional or a error?
@workgroupengineering Why would you consider this as an error? I'm not sure I understand the problem you're referencing.
Hi @carldebilly ,
When using the AppendLine method, the developer expects a carriage return to be added at the end of the line.
The issue is just a matter of correctly formatting the generated code.
Good point.
Agreed that this an unfortunate name for the method - the Line
suffix does imply a carriage return, by analogy with Console.WriteLine()
etc.
It would be a big breaking change to modify the behaviour, however, since when generating code (the main use case for IndentedStringBuilder
) it's often desirable (indeed necessary) to not start a new line before appending further content.