Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 9ea2589

Browse files
danmoseleystephentoub
authored andcommitted
In ImmutableArray.ToDictionary, presize Dictionary (#27280)
1 parent 6ab836d commit 9ea2589

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/System.Collections.Immutable/src/System/Linq/ImmutableArrayExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public static Dictionary<TKey, T> ToDictionary<TKey, T>(this ImmutableArray<T> i
608608
{
609609
Requires.NotNull(keySelector, nameof(keySelector));
610610

611-
var result = new Dictionary<TKey, T>(comparer);
611+
var result = new Dictionary<TKey, T>(immutableArray.Length, comparer);
612612
foreach (var v in immutableArray)
613613
{
614614
result.Add(keySelector(v), v);

0 commit comments

Comments
 (0)