课程: Learning C#
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
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…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。