String Interpolation

noun

say it: “STRING in-ter-puh-LAY-shun” /strɪŋ ɪnˌtɜːrpəˈleɪʃən/

Building a string from text and values by putting the values in curly braces inside a string that starts with $.

What is String Interpolation in C#?

String Interpolation — Building a string by placing expressions inside braces in a string beginning with $.

class Order
{
    string Describe(string item, int count)
    {
        return quot;{count} cups of {item}";
    }
}

In a sentence

  • “With string interpolation, quot;{name} scored {points} points" reads like the sentence it prints.”

Level: Apprentice · More C# terms at this level

Updated

In other subjects