From 4c29020751a11dacc15e8bfd95b6bc0f7103e272 Mon Sep 17 00:00:00 2001 From: James Ko Date: Sat, 24 Sep 2016 23:11:10 -0400 Subject: [PATCH] Micro-optimization for IList.Contains array implementation (#7347) --- src/mscorlib/src/System/Array.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mscorlib/src/System/Array.cs b/src/mscorlib/src/System/Array.cs index b5cbcf0..2260fd7 100644 --- a/src/mscorlib/src/System/Array.cs +++ b/src/mscorlib/src/System/Array.cs @@ -2799,7 +2799,7 @@ namespace System { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! T[] _this = JitHelpers.UnsafeCast(this); - return Array.IndexOf(_this, value) != -1; + return Array.IndexOf(_this, value, 0, _this.Length) >= 0; } bool get_IsReadOnly() { @@ -2818,7 +2818,7 @@ namespace System { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! T[] _this = JitHelpers.UnsafeCast(this); - return Array.IndexOf(_this, value); + return Array.IndexOf(_this, value, 0, _this.Length); } void Insert(int index, T value) { -- 2.7.4