C# 14 · Basics
Insert values into a string
Prefix a string with $ and put expressions in braces, with an optional format.
var message = $"{name} scored {score:P1} on {DateTime.Now:yyyy-MM-dd}";
C# 14 · Basics
Prefix a string with $ and put expressions in braces, with an optional format.
var message = $"{name} scored {score:P1} on {DateTime.Now:yyyy-MM-dd}";
Was this page helpful?