question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

c# 11 raw string literals

See original GitHub issue

per 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:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
damiengcommented, Apr 30, 2022

I’m planning on tackling the C# 11 features next week 😃

0reactions
kasperk81commented, May 4, 2022

ok. for reference, i can run it locally with daily build (first column from installer table) and here is an example running on sharplab.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found