Skip to content

Instantly share code, notes, and snippets.

@solrevdev
Last active August 21, 2022 09:25
Show Gist options
  • Select an option

  • Save solrevdev/f5157e0e3d5587b73da528562f9d95e6 to your computer and use it in GitHub Desktop.

Select an option

Save solrevdev/f5157e0e3d5587b73da528562f9d95e6 to your computer and use it in GitHub Desktop.
C# 11 Raw String Literal Example on SharpLab - https://sharplab.io/#gist:f5157e0e3d5587b73da528562f9d95e6
/*
SharpLab tools in Run mode:
• value.Inspect()
• Inspect.Heap(object)
• Inspect.Stack(value)
• Inspect.MemoryGraph(value1, value2, …)
*/
using System;
Console.WriteLine("🌄 C# 11 Raw String Literal Example");
var name = "John";
var jsonText = $$"""
{
"localizedLastName": "Smith",
"firstName": { "localized": { "en_US": "{{name}}" }, "preferredLocale": { "country": "US", "language": "en" } },
"lastName": { "localized": { "en_US": "Smith" }, "preferredLocale": { "country": "US", "language": "en" } },
"id": "123456",
"localizedFirstName": "John"
}
""";
Console.WriteLine(jsonText);
🌄 C# 11 Raw String Literal Example
{
"localizedLastName": "Smith",
"firstName": { "localized": { "en_US": "John" }, "preferredLocale": { "country": "US", "language": "en" } },
"lastName": { "localized": { "en_US": "Smith" }, "preferredLocale": { "country": "US", "language": "en" } },
"id": "123456",
"localizedFirstName": "John"
}
{
"version": 1,
"target": "Run",
"mode": "Debug",
"branch": "main"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment