Syntax

C# String Interpolation Syntax

In C#, string interpolation: inserts values into a string — $"Total: {total:C}"

Quick Answer

Syntax
$"Total: {total:C}"
C#Syntax

String Interpolation

Code example
$"Total: {total:C}"

Inserts values into a string.

Learn More

How to string interpolation in C#

  1. Open your C# file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C# String Interpolation Syntax

Use $"Total: {total:C}".

Related Syntax References

Frequently asked questions

What is the C# syntax for string interpolation?

Use this pattern: $"Total: {total:C}"

Can I copy this C# code example?

Yes. Use Copy code and adapt the example to your program.

Is this C# syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify