Today I learned about raw string literals introduced in C# 11.

The big improvement to me is that you don’t need to escape double quotes.

So no more of this noise if you need a json string:

    string json = @"
{
  ""number"": 42,
  ""text"": ""Hello, world"",
  ""nested"": { ""flag"": true }
}";

You can now write:

        string json = """
        {
          "number": 42,
          "text": "Hello, world",
          "nested": { "flag": true }
        }
        """;

The other nice feature is that an extraneous indentation will stripped out based on the location of the closing """. 🔥

This post goes into it deeper.