Marking Memory struct as readonly, fixing corefx#23809 (#14684)
authorAhson Khan <ahkha@microsoft.com>
Wed, 25 Oct 2017 16:44:00 +0000 (09:44 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 25 Oct 2017 16:44:00 +0000 (09:44 -0700)
src/mscorlib/shared/System/Memory.cs
src/mscorlib/shared/System/ReadOnlyMemory.cs

index 5011510..ecb33e8 100644 (file)
@@ -14,7 +14,7 @@ namespace System
 {
     [DebuggerDisplay("{DebuggerDisplay,nq}")]
     [DebuggerTypeProxy(typeof(MemoryDebugView<>))]
-    public struct Memory<T>
+    public readonly struct Memory<T>
     {
         // NOTE: With the current implementation, Memory<T> and ReadOnlyMemory<T> must have the same layout,
         // as code uses Unsafe.As to cast between them.
index 2216902..c2ba4ab 100644 (file)
@@ -14,7 +14,7 @@ namespace System
 {
     [DebuggerDisplay("{DebuggerDisplay,nq}")]
     [DebuggerTypeProxy(typeof(MemoryDebugView<>))]
-    public struct ReadOnlyMemory<T>
+    public readonly struct ReadOnlyMemory<T>
     {
         // NOTE: With the current implementation, Memory<T> and ReadOnlyMemory<T> must have the same layout,
         // as code uses Unsafe.As to cast between them.