Interpolated Verbatim Strings C# with Example



Interpolated Verbatim Strings C# with Example

Verbatim strings can be combined with the new String interpolation features found in C#6. 
Console.WriteLine($@"Testing \n 1 2 {5 - 2} 
New line"); 
Output: 
Testing \n 1 2 3 
New line 
Live Demo on .NET Fiddle 
As expected from a verbatim string, the backslashes are ignored as escape characters. And as expected from an 
interpolated string, any expression inside curly braces is evaluated before being inserted into the string at that 
position. 

0 Comment's

Comment Form

Submit Comment