Clarified about copying an immutable dictionary by WhiteBlackGoose · Pull Request #11877 · dotnet/dotnet-api-docs
Navigation Menu
{{ message }}
dotnet / dotnet-api-docs Public
- Notifications You must be signed in to change notification settings
- Fork 1.7k
Open
WhiteBlackGoose wants to merge 2 commits intodotnet:mainfrom
Open
Clarified about copying an immutable dictionary#11877
WhiteBlackGoose wants to merge 2 commits intodotnet:mainfrom
Clarified about copying an immutable dictionary#11877
WhiteBlackGoose wants to merge 2 commits intodotnet:mainfrom
Conversation
Copy link
Contributor
WhiteBlackGoose
commented
Oct 2, 2025
WhiteBlackGoose
commented
Summary
I think saying that a copy is made is misleading, because it makes the person assume a copy of the whole dictionary is made, whereas in reality operations like Add are O(log(N)) complex.
WhiteBlackGoose added 2 commits
October 2, 2025 21:15
WhiteBlackGoose
requested a review
from a team
as a code owner
github-actions
bot
added
the
area-System.Collections
label
dotnet-policy-service
bot
added
the
community-contribution
label
Oct 2, 2025Copy link
Contributor
dotnet-policy-service
bot
commented
Oct 2, 2025
dotnet-policy-service bot commented
Oct 2, 2025Tagging subscribers to this area: @dotnet/area-system-collections
WhiteBlackGoose commented Oct 2, 2025
|
|
||
| ## Remarks | ||
| When you manipulate an immutable dictionary a copy of the original dictionary is made, manipulations applied and a new immutable dictionary is returned. | ||
| When you manipulate an immutable dictionary, a new one is returned with the appropriate changes, while the old one is not altered. |
Copy link
Contributor Author
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, "a new instance"? Or even "a new instance if necessary"?
Copy link
Contributor Author
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively: using the old wording but with "minimal copy" instead of "copy". Or "minimal (optimized) copy"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment