What are Interpolated Strings


An interpolated string expression looks like a template string that contains expressions. An interpolated string expression creates a string by replacing the contained expressions with the ToString representations of the expressions’ results. An interpolated string is easier to understand with respect to arguments than Composite Formatting.
Example:
string language=”C#”;
string ide=”Visual Studio”;
Console.WriteLine($”Language = {language}, IDE= {ide}”);
It will print the following:
Language = C#, IDE = Visual Studio
MSDN


Leave a Reply

Your email address will not be published. Required fields are marked *