dotnet / dotnet/dotnet-api-docs

What does Dictionary<TKey,TValue>.EnsureCapacity(Int32) Method do?

Open
#3,271 2 comments 1 reaction 0 assignees View on GitHub
area-System.Collections doc-enhancement dotnet-api/prod Pri2 waiting-on-feedback
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Does it allocate space or just check to see if the space is currently allocatable? In bytes or element count?

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: c24739cd-50ff-e3b1-a5b7-5e43fea977b0
* Version Independent ID: 39331194-8f05-25b9-88bb-5f77a0c53e95
* Content: [Dictionary<TKey,TValue>.EnsureCapacity(Int32) Method (System.Collections.Generic)](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2.ensurecapacity?view=netcore-2.1&viewFallbackFrom=netframework-4.7.2)
* Content Source: [xml/System.Collections.Generic/Dictionary`2.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Collections.Generic/Dictionary`2.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.