RecyclableList.Remove modified to allow removing the last item.
This commit is contained in:
1 parent
ec355160f9
commit
2558f57934
2 files changed
+34
-2
No files matched your search
@@ -569,7 +569,18 @@ namespace Recyclable.Collections
|
||||
? Array.IndexOf(_memoryBlocks[0], item, 0, (int)_longCount)
|
||||
: DoIndexOf(item, _memoryBlocks, _lastBlockIndex, _blockSize, _nextItemIndex);
|
||||
|
||||
public bool Remove(T item) => throw new NotSupportedException();
|
||||
public bool Remove(T item)
|
||||
{
|
||||
var itemIndex = LongIndexOf(item);
|
||||
if (itemIndex >= 0)
|
||||
{
|
||||
RemoveAt(this, itemIndex, _defaultBlockArrayPool);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemoveBlock(int index)
|
||||
{
|
||||
if (_blockSize < RecyclableDefaults.MinPooledArrayLength)
|
||||
|
||||
Reference in new issue
Block a user