From f03f5bf483165c8661194a7839d9ec04a699c4c2 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Wed, 22 Feb 2017 11:02:09 +0100 Subject: [PATCH] Bump corefx --- external/corefx | 2 +- mcs/class/corlib/System/Array.cs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/external/corefx b/external/corefx index 10b23d34882..c00dde208d2 160000 --- a/external/corefx +++ b/external/corefx @@ -1 +1 @@ -Subproject commit 10b23d348821eeebbfe1db0b306e2d764655b4ed +Subproject commit c00dde208d25f180d881c37d465410ed2edd6939 diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs index 2027b128e93..d2565a3c209 100644 --- a/mcs/class/corlib/System/Array.cs +++ b/mcs/class/corlib/System/Array.cs @@ -1290,6 +1290,34 @@ namespace System } } + public static void Reverse(T[] array) + { + if (array == null) + throw new ArgumentNullException (nameof (array)); + + Reverse (array, 0, array.Length); + } + + public static void Reverse(T[] array, int index, int length) + { + if (array == null) + throw new ArgumentNullException (nameof (array)); + if (index < 0 || length < 0) + throw new ArgumentOutOfRangeException ((index < 0 ? nameof (index) : nameof (length))); + if (array.Length - index < length) + throw new ArgumentException (); + + int i = index; + int j = index + length - 1; + while (i < j) { + T temp = array [i]; + array [i] = array [j]; + array [j] = temp; + i++; + j--; + } + } + [ReliabilityContractAttribute (Consistency.MayCorruptInstance, Cer.MayFail)] public static void Sort (Array array) { -- 2.11.4.GIT