Skip to content

Commit

Permalink
Fixed regression of WriterAsReadOnlyCollection test
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Oct 25, 2023
1 parent 7d79a17 commit ab9ed11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/DotNext/Buffers/PooledArrayBufferWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ public ArrayPool<T>? BufferPool

/// <inheritdoc/>
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
=> buffer.CopyTo(array.AsSpan(arrayIndex, position));
{
var source = MemoryMarshal.CreateReadOnlySpan(ref MemoryMarshal.GetArrayDataReference(buffer), position);
source.CopyTo(array.AsSpan(arrayIndex));
}

/// <summary>
/// Gets the element at the specified index.
Expand Down

0 comments on commit ab9ed11

Please sign in to comment.