diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-12-05 08:01:02 -0800 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2018-12-05 11:01:02 -0500 |
commit | 6496481b4eec064188a50bcf5132191273d088f6 (patch) | |
tree | 91312639485e01371836c0935e0a0f141e3b480e | |
parent | e83cd30674466074632aa3f573c76e59f45f7d0f (diff) | |
download | coreclr-6496481b4eec064188a50bcf5132191273d088f6.tar.gz coreclr-6496481b4eec064188a50bcf5132191273d088f6.tar.bz2 coreclr-6496481b4eec064188a50bcf5132191273d088f6.zip |
Revert Array enumerator behavior change (#21368)
Fixes #21046
-rw-r--r-- | src/System.Private.CoreLib/src/System/Array.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/System.Private.CoreLib/src/System/Array.cs b/src/System.Private.CoreLib/src/System/Array.cs index 253ac51005..490ef91075 100644 --- a/src/System.Private.CoreLib/src/System/Array.cs +++ b/src/System.Private.CoreLib/src/System/Array.cs @@ -2665,16 +2665,15 @@ namespace System public bool MoveNext() { int index = _index + 1; - bool result = index < _array.Length; - - if (result) + if ((uint)index >= (uint)_array.Length) { - _index = index; + _index = _array.Length; + return false; } - - return result; + _index = index; + return true; } - + public T Current { get |