C#introdotnet

String interpolation and formatting

Build strings from values with $"...", then bend the output with format specifiers, alignment, and raw literals.

An interpolated string drops expressions straight into text; a :format suffix controls how each value renders (N2, C, P, X), an ,width aligns it, and """ raw literals let you write braces and quotes without escaping.

Embed expressions with $\

C#intro
0ms
Ada published her notes in 1843.3 copies cost 13.5 pounds.Use {braces} literally by doubling them.
Reference · output compiled offline, not runnable in-browser

Each {...} is evaluated in place — including the arithmetic {copies * price} which yields 13.5 — while the doubled {{braces}} print as a single literal {braces}, showing how interpolation reads in source order with no positional placeholders to mis-count.