diff --git a/Recyclable.Collections/RecyclableLongList.cs b/Recyclable.Collections/RecyclableLongList.cs index e6b7c8b..6d9fd9c 100644 --- a/Recyclable.Collections/RecyclableLongList.cs +++ b/Recyclable.Collections/RecyclableLongList.cs @@ -902,8 +902,9 @@ namespace Recyclable.Collections if (NeedsClearing) { - // TODO: Can we benefit from Span here? - _memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default; +#nullable disable + new Span(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = default; +#nullable restore } _version++; @@ -971,8 +972,9 @@ namespace Recyclable.Collections if (NeedsClearing) { - // TODO: Can we benefit from Span here? - _memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default; +#nullable disable + new Span(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = default; +#nullable restore } _version++; @@ -1010,8 +1012,9 @@ namespace Recyclable.Collections if (NeedsClearing) { - // TODO: Can we benefit from Span here? - _memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default; +#nullable disable + new Span(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = default; +#nullable restore } _version++;