Skip to content

Interpolated strings newline C# 11.0readability

Allow string interpolation to span multiple lines.

C# 11 allows interpolated strings C# 6.0 to span multiple lines. This is useful for long strings or when you want to break up a string into multiple lines for readability.

Code

C#
const string diskSignature = $"
Welcome to the Black Ice BBS 

Please login:";
C#
const string diskSignature = $"\nWelcome to the Black Ice BBS\n\nPlease login:";

More information