From 0c4ebd8356d65e9d2df05a67ebe4adcc8c337c1b Mon Sep 17 00:00:00 2001 From: lindexi Date: Sun, 31 May 2020 01:13:05 +0800 Subject: [PATCH] Init dictionary with clear count (#37041) --- .../src/CommandLineConfigurationProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/CommandLineConfigurationProvider.cs b/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/CommandLineConfigurationProvider.cs index a3cb1b9..c3a3ac9 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/CommandLineConfigurationProvider.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/CommandLineConfigurationProvider.cs @@ -137,7 +137,7 @@ namespace Microsoft.Extensions.Configuration.CommandLine // The dictionary passed in might be constructed with a case-sensitive comparer // However, the keys in configuration providers are all case-insensitive // So we check whether the given switch mappings contain duplicated keys with case-insensitive comparer - var switchMappingsCopy = new Dictionary(StringComparer.OrdinalIgnoreCase); + var switchMappingsCopy = new Dictionary(switchMappings.Count, StringComparer.OrdinalIgnoreCase); foreach (var mapping in switchMappings) { // Only keys start with "--" or "-" are acceptable -- 2.7.4