RecyclableList.AddRangeEnumerated fixed to update _count before resizing the collection, because RecyclableListHelpers<T>.ResizeAndCopy() relies on it.

This commit is contained in:
mlemanczyk committed 2023-07-16 11:55:54 +02:00
1 parent 75ad8227c2
commit 303fb68907
1 file changed
+1
+1
View File
@@ -36,6 +36,7 @@ namespace Recyclable.Collections
{
if (targetItemIndex + growByCount > capacity)
{
_count = targetItemIndex;
capacity = RecyclableListHelpers<T>.ResizeAndCopy(this, checked((int)BitOperations.RoundUpToPowerOf2((uint)(targetItemIndex + growByCount))));
memorySpan = new(_memoryBlock);
available = capacity - targetItemIndex;