Skip to content

Commit

Permalink
Added version increment for TrimExcess and EnsureCapacity (#19096)
Browse files Browse the repository at this point in the history
* Added version increment for TrimExcess and EnsureCapacity

* Added old unit test to exclusion list

* Excluded missing unit tests

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
  • Loading branch information
davidkaya authored and dotnet-bot committed Jul 30, 2018
1 parent 93169b6 commit b896e92
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ public int EnsureCapacity(int capacity)
int currentCapacity = _entries == null ? 0 : _entries.Length;
if (currentCapacity >= capacity)
return currentCapacity;
_version++;
if (_buckets == null)
return Initialize(capacity);
int newSize = HashHelpers.GetPrime(capacity);
Expand Down Expand Up @@ -1009,6 +1010,7 @@ public void TrimExcess(int capacity)
return;

int oldCount = _count;
_version++;
Initialize(newSize);
Entry[] entries = _entries;
int[] buckets = _buckets;
Expand Down

0 comments on commit b896e92

Please sign in to comment.