From d97e8854e0d2e7bbc8c549a68d9592c1dbc5ac4e Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Thu, 11 Jan 2018 00:56:01 -0800 Subject: [PATCH] Keep LowLevelDictionary for CoreRT for now (#15824) Signed-off-by: dotnet-bot --- .../shared/System/Globalization/CultureData.cs | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mscorlib/shared/System/Globalization/CultureData.cs b/src/mscorlib/shared/System/Globalization/CultureData.cs index 8b71d48..fda239c 100644 --- a/src/mscorlib/shared/System/Globalization/CultureData.cs +++ b/src/mscorlib/shared/System/Globalization/CultureData.cs @@ -9,6 +9,16 @@ using System.Threading; namespace System.Globalization { +#if CORERT + using StringStringDictionary = LowLevelDictionary; + using StringCultureDataDictionary = LowLevelDictionary; + using LcidToCultureNameDictionary = LowLevelDictionary; +#else + using StringStringDictionary = Dictionary; + using StringCultureDataDictionary = Dictionary; + using LcidToCultureNameDictionary = Dictionary; +#endif + // // List of culture data // Note the we cache overrides. @@ -150,13 +160,13 @@ namespace System.Globalization // (In future would be nice to be in registry or something) //Using a property so we avoid creating the dictionary until we need it - private static Dictionary RegionNames + private static StringStringDictionary RegionNames { get { if (s_RegionNames == null) { - Dictionary regionNames = new Dictionary(211 /* prime */); + StringStringDictionary regionNames = new StringStringDictionary(211 /* prime */); regionNames.Add("029", "en-029"); regionNames.Add("AE", "ar-AE"); @@ -295,8 +305,8 @@ namespace System.Globalization } // Cache of regions we've already looked up - private static volatile Dictionary s_cachedRegions; - private static volatile Dictionary s_RegionNames; + private static volatile StringCultureDataDictionary s_cachedRegions; + private static volatile StringStringDictionary s_RegionNames; internal static CultureData GetCultureDataForRegion(string cultureName, bool useUserOverride) { @@ -322,11 +332,11 @@ namespace System.Globalization // Try the hash table next string hashName = AnsiToLower(useUserOverride ? cultureName : cultureName + '*'); - Dictionary tempHashTable = s_cachedRegions; + StringCultureDataDictionary tempHashTable = s_cachedRegions; if (tempHashTable == null) { // No table yet, make a new one - tempHashTable = new Dictionary(); + tempHashTable = new StringCultureDataDictionary(); } else { @@ -561,7 +571,7 @@ namespace System.Globalization // Constructors // /////////////// // Cache of cultures we've already looked up - private static volatile Dictionary s_cachedCultures; + private static volatile StringCultureDataDictionary s_cachedCultures; private static readonly object s_lock = new object(); internal static CultureData GetCultureData(string cultureName, bool useUserOverride) @@ -574,11 +584,11 @@ namespace System.Globalization // Try the hash table first string hashName = AnsiToLower(useUserOverride ? cultureName : cultureName + '*'); - Dictionary tempHashTable = s_cachedCultures; + StringCultureDataDictionary tempHashTable = s_cachedCultures; if (tempHashTable == null) { // No table yet, make a new one - tempHashTable = new Dictionary(); + tempHashTable = new StringCultureDataDictionary(); } else { -- 2.7.4