Raw String Literal

noun

say it: “RAW STRING LIT-er-ul” /rɔː strɪŋ ˈlɪtərəl/

A C# string between three double quotes that can span lines and hold quotes without escaping, handy for SQL.

What is Raw String Literal in C#?

Raw String Literal — A multiline string enclosed by at least three double quotes with minimal escaping.

class Order
{
    int itemCount = 3;
    decimal price = 4.50m;
    char size = 'M';
    bool paid = true;
}

In a sentence

  • “I wrote the query as a raw string literal so it reads like the SQL in SSMS.”

Level: Apprentice · More C# terms at this level

Updated