diff options
author | James Ko <jamesqko@gmail.com> | 2016-11-27 12:35:55 -0500 |
---|---|---|
committer | James Ko <jamesqko@gmail.com> | 2016-11-27 12:35:55 -0500 |
commit | a2a8951f38b264e48653a1d77d81b8d77bf59d76 (patch) | |
tree | 792ef3067cc5ed607a21d6ebc42176dfcc6a26c6 /src/mscorlib | |
parent | 8f696732033b58a0cad119624535854c2dd48dff (diff) | |
download | coreclr-a2a8951f38b264e48653a1d77d81b8d77bf59d76.tar.gz coreclr-a2a8951f38b264e48653a1d77d81b8d77bf59d76.tar.bz2 coreclr-a2a8951f38b264e48653a1d77d81b8d77bf59d76.zip |
Revert some potentially breaking aspects
Diffstat (limited to 'src/mscorlib')
-rw-r--r-- | src/mscorlib/src/System/Collections/Generic/List.cs | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/mscorlib/src/System/Collections/Generic/List.cs b/src/mscorlib/src/System/Collections/Generic/List.cs index f12d99202e..0241934a17 100644 --- a/src/mscorlib/src/System/Collections/Generic/List.cs +++ b/src/mscorlib/src/System/Collections/Generic/List.cs @@ -1036,32 +1036,19 @@ namespace System.Collections.Generic { using (IEnumerator<T> en = enumerable.GetEnumerator()) { T[] items = _items; - int size = _size; - // Read in items from the enumerator, only updating fields - // when we run out of space. - - try + while (en.MoveNext()) { - while (en.MoveNext()) + if (_size == items.Length) { - if (size == items.Length) - { - _size = size; - EnsureCapacity(size + 1); - items = _items; - } - - // Note: It's important we increment size after Current is called. - // If that throws an exception we don't want to do the increment. - items[size] = en.Current; - size++; + EnsureCapacity(_size + 1); + items = _items; } - } - finally - { - // Make a final update to _size and _version after we've finished adding. - _size = size; + + // Note: It's important we increment size after Current is called. + // If that throws an exception we don't want to do the increment. + items[_size] = en.Current; + _size++; _version++; } } |