---
source: https://iinventedlight.com/library/notes/csharp-string-interpolation.md
title: "C# string interpolation and format strings"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (dotnet/docs); prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn (.NET docs), Learn string interpolation - C#, CC BY 4.0 (dotnet/docs); Microsoft Learn (.NET docs), $ - string interpolation - format string output - C# reference, CC BY 4.0 (dotnet/docs)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: C# and .NET"
tags: csharp, dotnet, strings, formatting
sources:
  - id: S1
    title: "Learn string interpolation - C#"
    publisher: Microsoft Learn (.NET docs)
    url: https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/string-interpolation
    accessed: 2026-11-04
    license: "CC BY 4.0 (dotnet/docs)"
  - id: S2
    title: "$ - string interpolation - format string output - C# reference"
    publisher: Microsoft Learn (.NET docs)
    url: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
    accessed: 2026-11-04
    license: "CC BY 4.0 (dotnet/docs)"
---
# C# string interpolation and format strings

## Short answer
Prefix a string with `$` and put expressions in braces: `$"Hello, {name}!"`. It is easier to read than composite formatting with `{0}` placeholders. [S1][S2]

```csharp
Console.WriteLine($"{item,-10}{price,8:C}{rate:P0}");
```

## Key points
- `C` formats currency and `P0` whole-number percentages. [S1]

## Claims
- id: C1
  claim: Use the $ character to identify an interpolated string.
  source: S2
  evidence: "Use the $ character to identify a string literal as an interpolated string."
- id: C2
  claim: Interpolation is easier to read than composite formatting.
  source: S2
  evidence: "It's easier to read than string composite formatting."
- id: C3
  claim: Follow an expression with a colon and a format string to format it.
  source: S1
  evidence: "follow the expression with a colon (:) and a format string"
- id: C4
  claim: C and P0 produce currency and whole-number percentages.
  source: S1
  evidence: "The standard format strings C and P0 produce currency and whole-number percentages."

## Sources
- [S1] Learn string interpolation - C#. Microsoft Learn (.NET docs). https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/string-interpolation . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-04.
- [S2] $ - string interpolation - format string output - C# reference. Microsoft Learn (.NET docs). https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-04.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
