RecyclableList.Capacity setter will now resize the array & update the version for enumerators. .Dispose will update the version to break enumerators.
This commit is contained in:
1 parent
cded3ced65
commit
55dd7ba078
1 file changed
+6
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user