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}";

Official C# 14 documentation

More basics commands

All basics commands · C# 14 cheatsheet

Was this page helpful?