From 9db490d8e9fed454f6ecaf8e51cbb5f7a0918761 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Tue, 24 Jan 2023 02:10:26 +0100 Subject: [PATCH] Fixed problem with RecyclableList.RemoveAt returning to the pool always the same block --- Recyclable.Collections/RecyclableList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index e61bad4..e12fff9 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -47,7 +47,7 @@ namespace Recyclable.Collections if ((list._capacity * blockSize) - oldCountMinus1 == blockSize) { T[][] memoryBlocks = list._memoryBlocks; - memoryBlocks[^1].ReturnToPool(_blockArrayPool); + memoryBlocks[list.BlockCount - 1].ReturnToPool(_blockArrayPool); list._capacity -= blockSize; } }