But off the top of my head, mainly just that there's a clear visual indicator of the start of lines of text, rather than counting/lining up leading whitespace. In the first example, the strings are all tabbed evenly for the sake of looking "pretty" in the code, but the following would generate the same string, since each line begins after the """:
var xml = """<element attr="content">
""" <body>
""" </body>
"""</element>
""";A few points.
> but the following would generate the same string, since each line begins after the """:
That's not a virtue here. The point is to be able to write clear literals that never need escapes and which allow for easy grokking of what the content actually is.
All current string forms in C# require some amount of manual (or tooling) help to fix them up to be legal. That's not the case with this literal. The content can always work as-is without having to touch it at all.
In my syntax, the IDE would ideally treat the """ block virtually like a <textarea>.
Note: this feature is entirely optional. You can absolutely not have leading whitespace trimming at all. Indeed, this is a requirement of the proposal as we have to make it possible to actually represent text that has leading whitespace :)