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

Commit d97e885

Browse files
dotnet-botjkotas
authored andcommitted
Keep LowLevelDictionary for CoreRT for now (#15824)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
1 parent 288bd46 commit d97e885

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/mscorlib/shared/System/Globalization/CultureData.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99

1010
namespace System.Globalization
1111
{
12+
#if CORERT
13+
using StringStringDictionary = LowLevelDictionary<string, string>;
14+
using StringCultureDataDictionary = LowLevelDictionary<string, CultureData>;
15+
using LcidToCultureNameDictionary = LowLevelDictionary<int, string>;
16+
#else
17+
using StringStringDictionary = Dictionary<string, string>;
18+
using StringCultureDataDictionary = Dictionary<string, CultureData>;
19+
using LcidToCultureNameDictionary = Dictionary<int, string>;
20+
#endif
21+
1222
//
1323
// List of culture data
1424
// Note the we cache overrides.
@@ -150,13 +160,13 @@ internal partial class CultureData
150160
// (In future would be nice to be in registry or something)
151161

152162
//Using a property so we avoid creating the dictionary until we need it
153-
private static Dictionary<string, string> RegionNames
163+
private static StringStringDictionary RegionNames
154164
{
155165
get
156166
{
157167
if (s_RegionNames == null)
158168
{
159-
Dictionary<string, string> regionNames = new Dictionary<string, string>(211 /* prime */);
169+
StringStringDictionary regionNames = new StringStringDictionary(211 /* prime */);
160170

161171
regionNames.Add("029", "en-029");
162172
regionNames.Add("AE", "ar-AE");
@@ -295,8 +305,8 @@ private static Dictionary<string, string> RegionNames
295305
}
296306

297307
// Cache of regions we've already looked up
298-
private static volatile Dictionary<string,CultureData> s_cachedRegions;
299-
private static volatile Dictionary<string, string> s_RegionNames;
308+
private static volatile StringCultureDataDictionary s_cachedRegions;
309+
private static volatile StringStringDictionary s_RegionNames;
300310

301311
internal static CultureData GetCultureDataForRegion(string cultureName, bool useUserOverride)
302312
{
@@ -322,11 +332,11 @@ internal static CultureData GetCultureDataForRegion(string cultureName, bool use
322332

323333
// Try the hash table next
324334
string hashName = AnsiToLower(useUserOverride ? cultureName : cultureName + '*');
325-
Dictionary<string,CultureData> tempHashTable = s_cachedRegions;
335+
StringCultureDataDictionary tempHashTable = s_cachedRegions;
326336
if (tempHashTable == null)
327337
{
328338
// No table yet, make a new one
329-
tempHashTable = new Dictionary<string,CultureData>();
339+
tempHashTable = new StringCultureDataDictionary();
330340
}
331341
else
332342
{
@@ -561,7 +571,7 @@ internal static CultureData Invariant
561571
// Constructors //
562572
///////////////
563573
// Cache of cultures we've already looked up
564-
private static volatile Dictionary<string,CultureData> s_cachedCultures;
574+
private static volatile StringCultureDataDictionary s_cachedCultures;
565575
private static readonly object s_lock = new object();
566576

567577
internal static CultureData GetCultureData(string cultureName, bool useUserOverride)
@@ -574,11 +584,11 @@ internal static CultureData GetCultureData(string cultureName, bool useUserOverr
574584

575585
// Try the hash table first
576586
string hashName = AnsiToLower(useUserOverride ? cultureName : cultureName + '*');
577-
Dictionary<string,CultureData> tempHashTable = s_cachedCultures;
587+
StringCultureDataDictionary tempHashTable = s_cachedCultures;
578588
if (tempHashTable == null)
579589
{
580590
// No table yet, make a new one
581-
tempHashTable = new Dictionary<string,CultureData>();
591+
tempHashTable = new StringCultureDataDictionary();
582592
}
583593
else
584594
{

0 commit comments

Comments
 (0)