Skip to content

String Interpolation

String interpolation embeds expressions inside a string using $ and {}.

string name = "Alice";
int age = 30;
Console.WriteLine($"Name: {name}, Age: {age}");
Terminal window
dotnet run
Terminal window
Name: Alice, Age: 30