Skip to content


Implement Span<byte>/ReadOnlySpan<byte> overloads
Browse files Browse the repository at this point in the history
Addresses #66

.NET Core 2.1 implements Read and Write overloads that accept Span
constructs. These constructs will work without overloading, but the
default implementations work via inefficient byte array copies.

This adds a netcoreapp2.1 target to the NuGet package, and implements
efficient overloads of Read(Span<byte>) and Write(ReadOnlySpan<byte>).
Overloads of ReadAsync and WriteAsync are not required, they have
efficient default implementations that will use these methods as needed.

The unit tests have also been updated to target .NET Core 2.1 so that
they can test the new method implementations.
  • Loading branch information
brantburnett committed Apr 5, 2019
1 parent 9de4de0 commit 86fc159
Show file tree
Hide file tree
Showing 5 changed files with 508 additions and 4 deletions.
2 changes: 1 addition & 1 deletion UnitTests/RecyclableMemoryStreamEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData)
this.EventWritten(eventData.EventId, (string)eventData.Payload[TagIndex]);

public virtual void EventWritten(int eventId, string tag)
public new virtual void EventWritten(int eventId, string tag)
switch (eventId)
Expand Down

0 comments on commit 86fc159

Please sign in to comment.