From eb0aaad31bcf08638936f650e5719131e39c5e2c Mon Sep 17 00:00:00 2001 From: Jesper Glintborg Date: Sun, 23 Jul 2023 00:24:03 +0200 Subject: [PATCH] Implemented AsSpan --- src/NetMQ/NetMQFrame.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/NetMQ/NetMQFrame.cs b/src/NetMQ/NetMQFrame.cs index 358998da4..bf1ee3e47 100644 --- a/src/NetMQ/NetMQFrame.cs +++ b/src/NetMQ/NetMQFrame.cs @@ -337,5 +337,14 @@ public byte[] ToByteArray(bool copy = false) return byteArray; } + + /// + /// Return an readonly span of bytes that carries the content of this NetMQFrames Buffer. + /// + /// the Buffer as a readonly span + public ReadOnlySpan AsSpan() + { + return new ReadOnlySpan(Buffer, 0, MessageSize); + } } }