Making Memory and ReadOnly readonly, fixing issue dotnet/corefx#23809 (dotnet/corefx...
authorAhson Ahmed Khan <ahsonkhan@users.noreply.github.com>
Thu, 28 Sep 2017 03:54:02 +0000 (20:54 -0700)
committerStephen Toub <stoub@microsoft.com>
Thu, 28 Sep 2017 03:54:02 +0000 (23:54 -0400)
Commit migrated from https://github.com/dotnet/corefx/commit/fa27201badbbce3cdb752d52593493a60c2f7d34

src/libraries/System.Memory/ref/System.Memory.cs
src/libraries/System.Memory/src/System/Memory.cs
src/libraries/System.Memory/src/System/ReadOnlyMemory.cs
src/libraries/System.Runtime/ref/System.Runtime.cs

index ee6ecea..04b521e 100644 (file)
@@ -123,7 +123,7 @@ namespace System
         public static ReadOnlySpan<TTo> NonPortableCast<TFrom, TTo>(this ReadOnlySpan<TFrom> source) where TFrom : struct where TTo : struct { throw null; }
     }
 
-    public struct ReadOnlyMemory<T>
+    public readonly struct ReadOnlyMemory<T>
     {
         public static ReadOnlyMemory<T> Empty { get { throw null; } }
         public ReadOnlyMemory(T[] array) { throw null;}
@@ -147,7 +147,7 @@ namespace System
         public bool DangerousTryGetArray(out ArraySegment<T> arraySegment) { throw null; }
     }
 
-    public struct Memory<T>
+    public readonly struct Memory<T>
     {
         public static Memory<T> Empty { get { throw null; } }
         public Memory(T[] array) { throw null;}
index a71fc76..c5779b7 100644 (file)
@@ -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.
     /// </summary>
-    public struct Memory<T>
+    public readonly struct Memory<T>
     {
         // 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<T>
index 5d5e3bd..5d901c5 100644 (file)
@@ -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.
     /// </summary>
-    public struct ReadOnlyMemory<T>
+    public readonly struct ReadOnlyMemory<T>
     {
         // 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<T>
index fbd1c2c..a8cf195 100644 (file)
@@ -1637,7 +1637,7 @@ namespace System
         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<T>
+    public readonly struct Memory<T>
     {
         public static Memory<T> Empty { get { throw null; } }
         public Memory(T[] array) { throw null;}
@@ -1861,7 +1861,7 @@ namespace System
         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<T>
+    public readonly struct ReadOnlyMemory<T>
     {
         public static ReadOnlyMemory<T> Empty { get { throw null; } }
         public ReadOnlyMemory(T[] array) { throw null;}