From 06f6f87df8432ea1c9105b7b755fd5534d5f7be5 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Wed, 21 Mar 2018 19:33:56 +0000 Subject: [PATCH] Small tweaks to Dict asm size (#17096) --- src/mscorlib/shared/System/Collections/Generic/Dictionary.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs b/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs index 16b7cdc..b62d3f8 100644 --- a/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs +++ b/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs @@ -268,9 +268,9 @@ namespace System.Collections.Generic _count = 0; _freeList = -1; _freeCount = 0; - _version++; Array.Clear(_entries, 0, count); } + _version++; } public bool ContainsKey(TKey key) @@ -440,6 +440,7 @@ namespace System.Collections.Generic ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key); } + _version++; if (_buckets == null) { Initialize(0); @@ -471,7 +472,6 @@ namespace System.Collections.Generic if (behavior == InsertionBehavior.OverwriteExisting) { entries[i].value = value; - _version++; return true; } @@ -509,7 +509,6 @@ namespace System.Collections.Generic if (behavior == InsertionBehavior.OverwriteExisting) { entries[i].value = value; - _version++; return true; } @@ -571,7 +570,6 @@ namespace System.Collections.Generic entry.value = value; // Value in _buckets is 1-based targetBucket = index + 1; - _version++; // Value types never rehash if (default(TKey) == null && collisionCount > HashHelpers.HashCollisionThreshold && comparer is NonRandomizedStringEqualityComparer) -- 2.7.4