From 35bd79548c0ef1b61f7de96d2abda2343315d2e3 Mon Sep 17 00:00:00 2001 From: ahsonkhan Date: Mon, 25 Sep 2017 17:01:03 -0700 Subject: [PATCH] Making Memory and ReadOnly readonly, fixing issue #23809 --- src/System.Memory/ref/System.Memory.cs | 4 ++-- src/System.Memory/src/System/Memory.cs | 2 +- src/System.Memory/src/System/ReadOnlyMemory.cs | 2 +- src/System.Runtime/ref/System.Runtime.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/System.Memory/ref/System.Memory.cs b/src/System.Memory/ref/System.Memory.cs index ee6ecea323e4..04b521e293fc 100644 --- a/src/System.Memory/ref/System.Memory.cs +++ b/src/System.Memory/ref/System.Memory.cs @@ -123,7 +123,7 @@ public static class SpanExtensions public static ReadOnlySpan NonPortableCast(this ReadOnlySpan source) where TFrom : struct where TTo : struct { throw null; } } - public struct ReadOnlyMemory + public readonly struct ReadOnlyMemory { public static ReadOnlyMemory Empty { get { throw null; } } public ReadOnlyMemory(T[] array) { throw null;} @@ -147,7 +147,7 @@ public struct ReadOnlyMemory public bool DangerousTryGetArray(out ArraySegment arraySegment) { throw null; } } - public struct Memory + public readonly struct Memory { public static Memory Empty { get { throw null; } } public Memory(T[] array) { throw null;} diff --git a/src/System.Memory/src/System/Memory.cs b/src/System.Memory/src/System/Memory.cs index a71fc76fb2ed..c5779b70ad7a 100644 --- a/src/System.Memory/src/System/Memory.cs +++ b/src/System.Memory/src/System/Memory.cs @@ -16,7 +16,7 @@ namespace System /// Memory represents a contiguous region of arbitrary memory similar to Span. /// Unlike Span, it is not a byref-like type. /// - public struct Memory + public readonly struct Memory { // The highest order bit of _index is used to discern whether _arrayOrOwnedMemory is an array or an owned memory // if (_index >> 31) == 1, object _arrayOrOwnedMemory is an OwnedMemory diff --git a/src/System.Memory/src/System/ReadOnlyMemory.cs b/src/System.Memory/src/System/ReadOnlyMemory.cs index 5d5e3bd78efc..5d901c518e00 100644 --- a/src/System.Memory/src/System/ReadOnlyMemory.cs +++ b/src/System.Memory/src/System/ReadOnlyMemory.cs @@ -16,7 +16,7 @@ namespace System /// ReadOnlyMemory represents a contiguous region of arbitrary similar to ReadOnlySpan. /// Unlike ReadOnlySpan, it is not a byref-like type. /// - public struct ReadOnlyMemory + public readonly struct ReadOnlyMemory { // The highest order bit of _index is used to discern whether _arrayOrOwnedMemory is an array or an owned memory // if (_index >> 31) == 1, object _arrayOrOwnedMemory is an OwnedMemory diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index fbd1c2cbdd91..a8cf195db662 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -1637,7 +1637,7 @@ public MemberAccessException(string message) { } public MemberAccessException(string message, System.Exception inner) { } protected MemberAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } } - public struct Memory + public readonly struct Memory { public static Memory Empty { get { throw null; } } public Memory(T[] array) { throw null;} @@ -1861,7 +1861,7 @@ public RankException(string message) { } public RankException(string message, System.Exception innerException) { } protected RankException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } } - public struct ReadOnlyMemory + public readonly struct ReadOnlyMemory { public static ReadOnlyMemory Empty { get { throw null; } } public ReadOnlyMemory(T[] array) { throw null;}