BEST SITE FOR WEB DEVELOPERS
C# Language. W3Schools lessons in English

Ua Es De

C# String Interpolation


String Interpolation

Another option of string concatenation is string interpolation, which substitutes values of variables into placeholders in a string. Note that you do not have to worry about spaces, like with concatenation:

Example

string firstName = "John";
string lastName = "Doe";
string name = $"My full name is: {firstName} {lastName}";
Console.WriteLine(name);

Try it Yourself »

Also note that you have to use the dollar sign ($) when using the string interpolation method.

String interpolation was introduced in C# version 6.