C# 11- New Lines in String Interpolation

Introduction:

C# 11 outcome with the new enhancement in the string interpolation to support a new lines, which means the text inside the { and } for a string interpolation can now span multiple lines.

New Lines in String Interpolation:

Before C#11 the below statement, new lines in string interpolation will throw a compile time error.

before C# 11 new lines in string interpolation will new lines

Now, C# 11 will support this feature, you won’t get any compile time errors.

String Interpolation with new Lines in C# 11

Summary:

We have seen a new feature, a support to multiple new lines in string interpolation in C# 11. It might be trivial, but it is very effective when it comes to readability by formatting the code.

gowthamk91

Leave a Reply

Discover more from Gowtham K

Subscribe now to keep reading and get access to the full archive.

Continue reading