Skip to content

Commit 8ef9923

Browse files
committed
Parameterless constructor is added
1 parent 58e5823 commit 8ef9923

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/DotNext.Tests/Buffers/MemoryWriterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static void ReadWriteUsingArray()
146146
[Fact]
147147
public static void StreamInterop()
148148
{
149-
using var writer = new PooledArrayBufferWriter<byte>(ArrayPool<byte>.Shared, 25);
149+
using var writer = new PooledArrayBufferWriter<byte>();
150150
var span = writer.GetSpan(10);
151151
new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.AsSpan().CopyTo(span);
152152
writer.Advance(10);

src/DotNext/Buffers/PooledArrayBufferWriter.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ public PooledArrayBufferWriter(ArrayPool<T> pool)
4040
buffer = Array.Empty<T>();
4141
}
4242

43+
/// <summary>
44+
/// Initializes a new writer with the default initial capacity and <see cref="ArrayPool{T}.Shared"/>
45+
/// as the array pooling mechanism.
46+
/// </summary>
47+
public PooledArrayBufferWriter()
48+
: this(ArrayPool<T>.Shared)
49+
{
50+
}
51+
4352
/// <summary>
4453
/// Gets the total amount of space within the underlying memory.
4554
/// </summary>

0 commit comments

Comments
 (0)