diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2019-07-02 15:33:16 +0200 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-07-02 06:33:16 -0700 |
commit | 948e0f2713c78fac5278826ee724a3f1503f2e2e (patch) | |
tree | def8bd6cda87f0940f6e64833a7f166767d3bff9 /src | |
parent | db90a795f5280ead19d5cc1780e9e25aad29fb8d (diff) | |
download | coreclr-948e0f2713c78fac5278826ee724a3f1503f2e2e.tar.gz coreclr-948e0f2713c78fac5278826ee724a3f1503f2e2e.tar.bz2 coreclr-948e0f2713c78fac5278826ee724a3f1503f2e2e.zip |
Use Array.MaxArrayLength in ArrayList (#25530)
Now that `ArrayList` is in CoreLib, we don't need the copy.
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Collections/ArrayList.cs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/ArrayList.cs b/src/System.Private.CoreLib/shared/System/Collections/ArrayList.cs index ba4a323c4e..7fdfaa03da 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/ArrayList.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/ArrayList.cs @@ -39,9 +39,6 @@ namespace System.Collections private const int _defaultCapacity = 4; - // Copy of Array.MaxArrayLength - internal const int MaxArrayLength = 0X7FEFFFFF; - // Note: this constructor is a bogus constructor that does nothing // and is for use only with SyncArrayList. internal ArrayList(bool trash) @@ -347,7 +344,7 @@ namespace System.Collections int newCapacity = _items.Length == 0 ? _defaultCapacity : _items.Length * 2; // Allow the list to grow to maximum possible capacity (~2G elements) before encountering overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast - if ((uint)newCapacity > MaxArrayLength) newCapacity = MaxArrayLength; + if ((uint)newCapacity > Array.MaxArrayLength) newCapacity = Array.MaxArrayLength; if (newCapacity < min) newCapacity = min; Capacity = newCapacity; } |