c# 11 raw string literals
See original GitHub issueper docs, these are valid and invalid cases starting with c# 11
// valid
x = $"""The point "{X}, {Y}" is {Math.Sqrt(X * X + Y * Y)} from the origin""";
x = $"""The point ""{X}, {Y}"" is {Math.Sqrt(X * X + Y * Y)} from the origin""";
x = $""""The point """{X}, {Y}""" is {Math.Sqrt(X * X + Y * Y)} from the origin"""";
x = $$"""The point {{{X}}, {{Y}}} is {{Math.Sqrt(X * X + Y * Y)}} from the origin""";
// invalid
x = $"The point "{X}, {Y}" is {Math.Sqrt(X * X + Y * Y)} from the origin";
x = $""The point ""{X}, {Y}"" is {Math.Sqrt(X * X + Y * Y)} from the origin"";
x = $"""The point """{X}, {Y}""" is {Math.Sqrt(X * X + Y * Y)} from the origin""";
x = $$"""The point {{X}, {{Y}}} is {{Math.Sqrt(X * X + Y * Y)}} from the origin""";
also take a look at ‘what’s new in c# 11’ series: https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11#raw-string-literals
tree-sitter doesn’t handle valid cases.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
C# 11 Preview Updates - Raw string literals, UTF-8 and more!
Raw string literals start and end with at least three double quotes ( """...""" ). Within these double quotes, single " are considered...
Read more >C# 11 – What are Raw String Literals - The Code Blogger
A “raw string literal” is a special type of string literal. It can be identified by three double quotes at the beginning and...
Read more >Raw String Literal in C++ - GeeksforGeeks
A Literal is a constant variable whose value does not change during the lifetime of the program. Whereas, a raw string literal is...
Read more >String literal - cppreference.com
6) Raw string literal. Used to avoid escaping of any character. Anything between the delimiters becomes part of the string. prefix, if present, ......
Read more >C# 11 Raw String Literals Explained - NDepend
A raw string literal necessarily starts and ends with at least 3x double quote characters """ . At least is in bold because...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m planning on tackling the C# 11 features next week 😃
ok. for reference, i can run it locally with daily build (first column from installer table) and here is an example running on sharplab.