-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect docstring on List.EnsureCapacity #95956
Conversation
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsThe current docstring is false. The new capacity is computed as "twice the current capacity, and if that's still not enough, the user-specified capacity", as demonstrated in net8.0.100:
|
src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This fix should be ported to official docs at https://github.com/dotnet/dotnet-api-docs/blob/c13606c90f809a9f04ca31db11d9701c696240f1/xml/System.Collections.Generic/List%601.xml#L1498-L1499 Also, do other collections have the same problem? E.g. https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.stack-1.ensurecapacity?view=net-7.0#definition |
The current docstring is false. The new capacity is computed as "twice the current capacity, and if that's still not enough, the user-specified capacity", as demonstrated in net8.0.100: