Skip to content

Conversation

gbad8
Copy link

@gbad8 gbad8 commented Oct 15, 2025

Summary

The example on Composite format string formatting was reffering to an object called name. However, the String.Format method was using simply a string.


Internal previews

📄 File 🔗 Preview link
docs/standard/base-types/composite-formatting.md Composite formatting

The example on (Composite format string)[https://learn.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting#composite-format-string] was reffering to a object called name. However, the String.Format method was using simply a string.
@Copilot Copilot AI review requested due to automatic review settings October 15, 2025 20:49
@gbad8 gbad8 requested review from a team and adegeo as code owners October 15, 2025 20:49
@dotnetrepoman dotnetrepoman bot added this to the October 2025 milestone Oct 15, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-fundamentals/svc community-contribution Indicates PR is created by someone from the .NET community. labels Oct 15, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fix a documentation inaccuracy in the Composite formatting article by aligning the explanatory text with the actual example arguments.

  • Clarifies that index 0 refers to the string "Fred" instead of an object named "name".
  • Keeps the rest of the explanation intact.


<!-- markdownlint-disable-next-line no-space-in-code -->
The fixed text is `Name = `&nbsp;and `, hours = `. The format items are `{0}`, whose index of 0 corresponds to the object `name`, and `{1:hh}`, whose index of 1 corresponds to the object `DateTime.Now`.
The fixed text is `Name = `&nbsp;and `, hours = `. The format items are `{0}`, whose index of 0 corresponds to the string `"Fred"`, and `{1:hh}`, whose index of 1 corresponds to the object `DateTime.Now`.
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

[nitpick] The phrase "object DateTime.Now" is imprecise here; consider clarifying terminology and using "string literal" for consistency. Suggested rewrite: "The fixed text is Name =  and , hours = . The format items are {0}, whose index of 0 corresponds to the string literal "Fred", and {1:hh}, whose index of 1 corresponds to the value of DateTime.Now."

Suggested change
The fixed text is `Name = `&nbsp;and `, hours = `. The format items are `{0}`, whose index of 0 corresponds to the string `"Fred"`, and `{1:hh}`, whose index of 1 corresponds to the object `DateTime.Now`.
The fixed text is `Name = `&nbsp;and `, hours = `. The format items are `{0}`, whose index of 0 corresponds to the string literal `"Fred"`, and `{1:hh}`, whose index of 1 corresponds to the value of `DateTime.Now`.

Copilot uses AI. Check for mistakes.

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-fundamentals/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant