Thursday, June 2, 2016

Using a verbatim string to span multiple lines

Today during a code review, I noticed the following code snippet(I changed the code a little bit to proof my point):

Although I was happy to see the usage of a StringBuilder to optimize the string concatination process, in this case, as the full string message was static, it would have been easier to just use a verbatim string literal to create the multiline statement at once:

1 comment:

Anonymous said...

If you indent the verbatim string then it's no longer exactly the same, the indentation counts as part of the string body :)