Remove CreateFromPinnedArray from Memory (moved to MemoryMarshal) (#17532)
authorAhson Khan <ahkha@microsoft.com>
Fri, 13 Apr 2018 04:52:24 +0000 (21:52 -0700)
committerGitHub <noreply@github.com>
Fri, 13 Apr 2018 04:52:24 +0000 (21:52 -0700)
src/mscorlib/shared/System/Memory.cs

index a500ec5..26f4e4c 100644 (file)
@@ -162,37 +162,6 @@ namespace System
             _length = length;
         }
 
-        /// <summary>
-        /// Creates a new memory over the portion of the pre-pinned target array beginning
-        /// at 'start' index and ending at 'end' index (exclusive).
-        /// </summary>
-        /// <param name="array">The pre-pinned target array.</param>
-        /// <param name="start">The index at which to begin the memory.</param>
-        /// <param name="length">The number of items in the memory.</param>
-        /// <remarks>Returns default when <paramref name="array"/> is null.</remarks>
-        /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
-        /// <exception cref="System.ArgumentOutOfRangeException">
-        /// Thrown when the specified <paramref name="start"/> or end index is not in the range (&lt;0 or &gt;=Length).
-        /// </exception>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static Memory<T> CreateFromPinnedArray(T[] array, int start, int length)
-        {
-            if (array == null)
-            {
-                if (start != 0 || length != 0)
-                    ThrowHelper.ThrowArgumentOutOfRangeException();
-                return default;
-            }
-            if (default(T) == null && array.GetType() != typeof(T[]))
-                ThrowHelper.ThrowArrayTypeMismatchException();
-            if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
-                ThrowHelper.ThrowArgumentOutOfRangeException();
-
-            // Before using _length, check if _length < 0, then 'and' it with RemoveFlagsBitMask
-            return new Memory<T>((object)array, start, length | (1 << 31));
-        }
-
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         internal Memory(object obj, int start, int length)
         {