From bc891fb7c99344e2ac79e63df7dd955f51663578 Mon Sep 17 00:00:00 2001 From: Piotr Szulakowski Date: Fri, 22 Sep 2023 16:02:49 +0200 Subject: [PATCH] Add readonly attribute to AsSpan() methods in InteropArray --- NoiseEngine/Interop/InteropArray.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NoiseEngine/Interop/InteropArray.cs b/NoiseEngine/Interop/InteropArray.cs index 5843724b..fb449cdc 100644 --- a/NoiseEngine/Interop/InteropArray.cs +++ b/NoiseEngine/Interop/InteropArray.cs @@ -85,7 +85,7 @@ public struct InteropArray : IDisposable, IReadOnlyList where T : unmanage /// Creates a view into the native memory. Span becomes invalid when the object is disposed. /// /// Span with the view of the memory held by this object. - public unsafe Span AsSpan() { + public readonly unsafe Span AsSpan() { return new Span(pointer, Length); } @@ -96,7 +96,7 @@ public struct InteropArray : IDisposable, IReadOnlyList where T : unmanage /// Start index of the span. /// Span with the view of the memory held by this object. /// is out of range. - public unsafe Span AsSpan(int start) { + public readonly unsafe Span AsSpan(int start) { if (start < 0 || start > Length) { throw new ArgumentOutOfRangeException(nameof(start)); } @@ -114,7 +114,7 @@ public struct InteropArray : IDisposable, IReadOnlyList where T : unmanage /// /// is out of range or is invalid. /// - public unsafe Span AsSpan(int start, int length) { + public readonly unsafe Span AsSpan(int start, int length) { if (start < 0 || start > Length) { throw new ArgumentOutOfRangeException(nameof(start)); }