From d165dc43395cef39ea5cdad39d8149615e6ba0a9 Mon Sep 17 00:00:00 2001 From: jbevain Date: Thu, 2 Apr 2009 17:39:17 +0000 Subject: [PATCH] optimize a bit the fix to avoid double checking git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@130886 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/corlib/System.Collections.Generic/Dictionary.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/class/corlib/System.Collections.Generic/Dictionary.cs b/class/corlib/System.Collections.Generic/Dictionary.cs index 4cb79bac86..736cfd79c9 100644 --- a/class/corlib/System.Collections.Generic/Dictionary.cs +++ b/class/corlib/System.Collections.Generic/Dictionary.cs @@ -965,15 +965,15 @@ namespace System.Collections.Generic { void ICollection.CopyTo (Array array, int index) { - IList list = array; - CopyToCheck (list, index); - var target = array as TKey []; if (target != null) { CopyTo (target, index); return; } + IList list = array; + CopyToCheck (list, index); + for (int i = 0; i < dictionary.touchedSlots; i++) { if ((dictionary.linkSlots [i].HashCode & HASH_FLAG) != 0) list [index++] = dictionary.keySlots [i]; @@ -1102,15 +1102,15 @@ namespace System.Collections.Generic { void ICollection.CopyTo (Array array, int index) { - IList list = array; - CopyToCheck (list, index); - var target = array as TValue []; if (target != null) { CopyTo (target, index); return; } + IList list = array; + CopyToCheck (list, index); + for (int i = 0; i < dictionary.touchedSlots; i++) { if ((dictionary.linkSlots [i].HashCode & HASH_FLAG) != 0) list [index++] = dictionary.valueSlots [i]; -- 2.11.4.GIT