RecyclableLongList.VersionedEnumerator will clear the current value only when it's reference type. Tiny cleanup.

This commit is contained in:
mlemanczyk committed 2023-07-01 14:08:19 +02:00
1 parent 55dd7ba078
commit ec9733b976
1 file changed
+6 -4
@@ -14,8 +14,6 @@ namespace Recyclable.Collections
private static readonly T _default = default;
#nullable restore
private static readonly bool _isReferenceType = !typeof(T).IsValueType;
private int _currentBlockIndex;
private int _currentItemIndex;
private readonly RecyclableLongList<T> _list;
@@ -88,14 +86,18 @@ namespace Recyclable.Collections
throw new InvalidOperationException();
}
_current = _default;
if (NeedsClearing)
{
_current = _default;
}
_currentBlockIndex = 0;
_currentItemIndex = 0;
}
public void Dispose()
{
if (_isReferenceType)
if (NeedsClearing)
{
_current = _default;
}