Skip to content

Fix equality check between sb1 and sb2#12274

Open
mahfeshar wants to merge 1 commit intodotnet:mainfrom
mahfeshar:patch-2
Open

Fix equality check between sb1 and sb2#12274
mahfeshar wants to merge 1 commit intodotnet:mainfrom
mahfeshar:patch-2

Conversation

@mahfeshar
Copy link

This PR/Issue corrects outdated information in the StringBuilder.Equals(StringBuilder) documentation to align it with modern .NET behavior (starting from .NET Core 3.0 through .NET 10).

Key Changes:

Updated section: Removed references to Capacity and MaxCapacity equality, as these properties are no longer part of the comparison logic in modern .NET versions.

Corrected Example Output: Updated the sample code's expected output for case b4. Previously, the example incorrectly stated that sb1.Equals(sb2) would return False when capacities differed. In modern .NET, this returns True as it performs an ordinal string comparison.

Consistency: Resolved the contradiction between the "Remarks" section (which correctly described the .NET Core 3.0+ behavior) and the "Returns/Example" sections which were still reflecting the legacy .NET Framework behavior.

Corrected the comparison result of sb1 and sb2 to reflect that they are equal.
@mahfeshar mahfeshar requested a review from a team as a code owner January 31, 2026 17:21
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 31, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant