Skip to content

Update documentation for constant interpolated strings - #55888

Open
asundheimMSFT wants to merge 1 commit into
dotnet:mainfrom
asundheimMSFT:patch-1
Open

Update documentation for constant interpolated strings#55888
asundheimMSFT wants to merge 1 commit into
dotnet:mainfrom
asundheimMSFT:patch-1

Conversation

@asundheimMSFT

@asundheimMSFT asundheimMSFT commented Sep 4, 2026

Copy link
Copy Markdown

Overview

Clarify that interpolated expressions must be constant strings for building constant interpolated strings, fix spacing between sentences.

Details

Reading the old version, you might get confused as to why you cannot interpolate const integral values into strings, like this:
image

Also the sentence was missing a space after the .:
image


Internal previews

File Preview link
docs/csharp/fundamentals/strings/interpolation.md Learn preview

Build report

Clarifythat interpolated expressions must be constant strings for building constant interpolated strings, fix spacing between sentences.
@asundheimMSFT
asundheimMSFT requested review from a team and BillWagner as code owners September 4, 2026 17:37
Copilot AI lite review requested due to automatic review settings September 4, 2026 17:37
@dotnetrepoman dotnetrepoman Bot added this to the September 2026 milestone Sep 4, 2026
@dotnet-policy-service dotnet-policy-service Bot added dotnet-csharp/svc fundamentals/subsvc community-contribution Indicates PR is created by someone from the .NET community. labels Sep 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The update is small, accurate relative to the accompanying example snippet, and improves clarity without introducing new issues.

Pull request overview

This PR updates the C# string interpolation documentation to clarify the rules for constant interpolated strings and correct a sentence-spacing issue, reducing confusion about why non-string constants (for example, const int) can’t be interpolated in a constant context.

Changes:

  • Clarified that each interpolated expression must be a constant string value for the overall interpolated string to be a compile-time constant.
  • Fixed missing whitespace between sentences in the “Build constant strings” section.
File summaries
File Description
docs/csharp/fundamentals/strings/interpolation.md Clarifies the “constant interpolated strings” requirement and fixes sentence spacing for readability.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@asundheimMSFT

Copy link
Copy Markdown
Author

FWIW this page: https://ironsoftware.com/academy/whats-new-in-csharp-and-dotnet/csharp-constant-interpolation-dotnet6-10-minutes/

seems to poison AI search engine results:
image

We should probably be more forceful about the distinction in our docs (but this version of the changes seemed the most straightforward / un-objectionable for now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc fundamentals/subsvc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants