CSharp 11

Microsoft Learn

Raw string literals
Lar deg lage strings uten å måtte escape. F.eks. med indentering og quotes.

string longMessage = """ 
	This is a long message. 
	It has several lines. 
		Some are indented 
			more than others. 
	Some should start at the first column. 
	Some have "quoted text" in them. 
	""";

Rider støtter også at man setter lang via kommentar for å få formateringshjelp.

//lang=JSON
var json = """
	{
		"name": "Ole",
		"age": 28	
	}

StringSyntax

privat void ExecuteQuery([StringSyntax("SQL")] string query){}

private void DoSomeWork()
{
	ExecuteQuery("SELECT * from TABLE")
}