Skip to content

Commit eb0aaad

Browse files
author
Jesper Glintborg
committed
Implemented AsSpan
1 parent 226248a commit eb0aaad

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/NetMQ/NetMQFrame.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,5 +337,14 @@ public byte[] ToByteArray(bool copy = false)
337337

338338
return byteArray;
339339
}
340+
341+
/// <summary>
342+
/// Return an readonly span of bytes that carries the content of this NetMQFrames Buffer.
343+
/// </summary>
344+
/// <returns>the Buffer as a readonly span</returns>
345+
public ReadOnlySpan<byte> AsSpan()
346+
{
347+
return new ReadOnlySpan<byte>(Buffer, 0, MessageSize);
348+
}
340349
}
341350
}

0 commit comments

Comments
 (0)