Merge pull request #6904 from erikma/dev/erikmav/byteStringMemory

C#: Allow readonly view of byteString's data with ByteString.Memory property
diff --git a/csharp/src/Google.Protobuf/ByteString.cs b/csharp/src/Google.Protobuf/ByteString.cs
index 8e7d03f..027c8d8 100644
--- a/csharp/src/Google.Protobuf/ByteString.cs
+++ b/csharp/src/Google.Protobuf/ByteString.cs
@@ -116,6 +116,12 @@
         /// No data is copied so this is the most efficient way of accessing.

         /// </summary>

         public ReadOnlySpan<byte> Span => new ReadOnlySpan<byte>(bytes);

+

+        /// <summary>

+        /// Provides read-only access to the data of this <see cref="ByteString"/>.

+        /// No data is copied so this is the most efficient way of accessing.

+        /// </summary>

+        public ReadOnlyMemory<byte> Memory => new ReadOnlyMemory<byte>(bytes);

 #endif

 

         /// <summary>