From the course: Learning C#

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

String interpolation

String interpolation - C# Tutorial

From the course: Learning C#

String interpolation

- [Instructor] Now that we've seen how to use string formatting, let's take a look at a very closely related feature called string interpolation. This feature lets you place variables and expressions directly into a string, instead of having to use the index placeholders like we've seen so far in the course. So let's take a look at an example. So here, in the Interpolation folder, let's open the program code. So here in these variables, I have some information about a car in different datatypes. So I've got some strings, an integer, a floating point, and a decimal value. So using regular string formatting, I would have a string like this one. So I'd have my indexes and I've got the index placeholders. I've got my variables at the end of the string and so on. So using string interpolation, I can skip this index notation and actually embed these variables into the string, itself. So let's see how to do that. What I'm going…

Contents