From 990f860b39ba93cc1ece03ee84bd4089cf1e6dd2 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 1 Apr 2023 17:11:47 +0100 Subject: [PATCH] perf: accept ReadOnlySpan in WriteInternal This method does not mutate the input span in any way, and so its input can be read-only. --- X10D/src/IO/StreamExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/X10D/src/IO/StreamExtensions.cs b/X10D/src/IO/StreamExtensions.cs index a843efd..d2726b0 100644 --- a/X10D/src/IO/StreamExtensions.cs +++ b/X10D/src/IO/StreamExtensions.cs @@ -1,4 +1,4 @@ -using System.Buffers.Binary; +using System.Buffers.Binary; using System.Reflection; using System.Runtime.InteropServices; using System.Security.Cryptography; @@ -1147,7 +1147,7 @@ public static class StreamExtensions return (int)(stream.Position - preWritePosition); } - private static int WriteInternal(this Stream stream, Span value) + private static int WriteInternal(this Stream stream, ReadOnlySpan value) { long preWritePosition = stream.Position; stream.Write(value);