@@ -111,14 +111,13 @@ internal sealed partial class CultureData
111
111
private string ? _sAM1159 ; // (user can override) AM designator
112
112
private string ? _sPM2359 ; // (user can override) PM designator
113
113
private string ? _sTimeSeparator ;
114
- private volatile string [ ] ? _saLongTimes ; // (user can override) time format
115
- private volatile string [ ] ? _saShortTimes ; // (user can override) short time format
116
- private volatile string [ ] ? _saDurationFormats ; // time duration format
114
+ private string [ ] ? _saLongTimes ; // (user can override) time format
115
+ private string [ ] ? _saShortTimes ; // (user can override) short time format
117
116
118
117
// Calendar specific data
119
118
private int _iFirstDayOfWeek = undef ; // (user can override) first day of week (gregorian really)
120
119
private int _iFirstWeekOfYear = undef ; // (user can override) first week of year (gregorian really)
121
- private volatile CalendarId [ ] ? _waCalendars ; // all available calendar type(s). The first one is the default calendar
120
+ private CalendarId [ ] ? _waCalendars ; // all available calendar type(s). The first one is the default calendar
122
121
123
122
// Store for specific data about each calendar
124
123
private CalendarData ? [ ] ? _calendars ; // Store for specific calendar data
@@ -150,7 +149,7 @@ internal sealed partial class CultureData
150
149
/// </remarks>
151
150
private static Dictionary < string , string > RegionNames =>
152
151
s_regionNames ??=
153
- new Dictionary < string , string > ( 257 /* prime */ , StringComparer . OrdinalIgnoreCase )
152
+ new Dictionary < string , string > ( 255 , StringComparer . OrdinalIgnoreCase )
154
153
{
155
154
{ "001" , "en-001" } ,
156
155
{ "029" , "en-029" } ,
@@ -411,7 +410,7 @@ internal sealed partial class CultureData
411
410
412
411
// Cache of regions we've already looked up
413
412
private static volatile Dictionary < string , CultureData > ? s_cachedRegions ;
414
- private static volatile Dictionary < string , string > ? s_regionNames ;
413
+ private static Dictionary < string , string > ? s_regionNames ;
415
414
416
415
/// <summary>
417
416
/// The culture name to use to interop with the underlying native globalization libraries like ICU or Windows NLS APIs.
@@ -621,7 +620,6 @@ private static CultureData CreateCultureWithInvariantData()
621
620
invariant . _sPM2359 = "PM" ; // PM designator
622
621
invariant . _saLongTimes = new string [ ] { "HH:mm:ss" } ; // time format
623
622
invariant . _saShortTimes = new string [ ] { "HH:mm" , "hh:mm tt" , "H:mm" , "h:mm tt" } ; // short time format
624
- invariant . _saDurationFormats = new string [ ] { "HH:mm:ss" } ; // time duration format
625
623
626
624
// Calendar specific data
627
625
invariant . _iFirstDayOfWeek = 0 ; // first day of week
@@ -661,7 +659,7 @@ private static CultureData CreateCultureWithInvariantData()
661
659
/// We need an invariant instance, which we build hard-coded
662
660
/// </summary>
663
661
internal static CultureData Invariant => s_Invariant ??= CreateCultureWithInvariantData ( ) ;
664
- private static volatile CultureData ? s_Invariant ;
662
+ private static CultureData ? s_Invariant ;
665
663
666
664
// Cache of cultures we've already looked up
667
665
private static volatile Dictionary < string , CultureData > ? s_cachedCultures ;
@@ -1381,18 +1379,10 @@ internal string[] LongTimes
1381
1379
{
1382
1380
if ( _saLongTimes == null && ! GlobalizationMode . Invariant )
1383
1381
{
1384
- Debug . Assert ( ! GlobalizationMode . Invariant ) ;
1385
-
1386
1382
string [ ] ? longTimes = GetTimeFormatsCore ( shortFormat : false ) ;
1387
- if ( longTimes == null || longTimes . Length == 0 )
1388
- {
1389
- _saLongTimes = Invariant . _saLongTimes ! ;
1390
- }
1391
- else
1392
- {
1393
- _saLongTimes = longTimes ;
1394
- }
1383
+ _saLongTimes = longTimes != null && longTimes . Length != 0 ? longTimes : Invariant . _saLongTimes ! ;
1395
1384
}
1385
+
1396
1386
return _saLongTimes ! ;
1397
1387
}
1398
1388
}
@@ -1407,23 +1397,13 @@ internal string[] ShortTimes
1407
1397
{
1408
1398
if ( _saShortTimes == null && ! GlobalizationMode . Invariant )
1409
1399
{
1410
- Debug . Assert ( ! GlobalizationMode . Invariant ) ;
1411
-
1412
1400
// Try to get the short times from the OS/culture.dll
1401
+ // If we couldn't find short times, then compute them from long times
1402
+ // (eg: CORECLR on < Win7 OS & fallback for missing culture.dll)
1413
1403
string [ ] ? shortTimes = GetTimeFormatsCore ( shortFormat : true ) ;
1414
-
1415
- if ( shortTimes == null || shortTimes . Length == 0 )
1416
- {
1417
- //
1418
- // If we couldn't find short times, then compute them from long times
1419
- // (eg: CORECLR on < Win7 OS & fallback for missing culture.dll)
1420
- //
1421
- shortTimes = DeriveShortTimesFromLong ( ) ;
1422
- }
1423
-
1424
- // Found short times, use them
1425
- _saShortTimes = shortTimes ;
1404
+ _saShortTimes = shortTimes != null && shortTimes . Length != 0 ? shortTimes : DeriveShortTimesFromLong ( ) ;
1426
1405
}
1406
+
1427
1407
return _saShortTimes ! ;
1428
1408
}
1429
1409
}
0 commit comments