From 55dd7ba078877cba6c66b22fa2b773208ddb1d18 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 1 Jul 2023 14:06:04 +0200 Subject: [PATCH] RecyclableList.Capacity setter will now resize the array & update the version for enumerators. .Dispose will update the version to break enumerators. --- Recyclable.Collections/RecyclableLongList.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Recyclable.Collections/RecyclableLongList.cs b/Recyclable.Collections/RecyclableLongList.cs index f418f9f..377ec46 100644 --- a/Recyclable.Collections/RecyclableLongList.cs +++ b/Recyclable.Collections/RecyclableLongList.cs @@ -41,6 +41,11 @@ namespace Recyclable.Collections { _capacity = value; _version++; + if (_capacity != value) + { + _capacity = Resize(this, _blockSize, _blockSizePow2BitShift, value); + _version++; + } } } @@ -1277,6 +1282,7 @@ namespace Recyclable.Collections public void Dispose() { + _version++; if (_capacity > 0) { Clear();