Embedding JSON, XML, or SQL in C# has always been painful (escaping quotes). Raw String Literals fix this.
var json = """
{
"name": "John",
"age": 30
}
""";
var sql = """
SELECT * FROM Users
WHERE Name = 'O''Brien' -- No escaping needed!
""";
The number of " characters is variable (minimum 3). The content is exactly what you type.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.