Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Pro

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:


string firstName = "John";
string lastName = "Doe";
string name = $"My full name is: {firstName} {lastName}";

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.