1515
1616namespace System . Globalization
1717{
18- #if CORECLR
19- using StringList = List < string > ;
20- #else
21- using StringList = LowLevelList < string > ;
22- #endif
23-
2418 internal partial class CultureData
2519 {
2620 private const uint LOCALE_NOUSEROVERRIDE = 0x80000000 ;
@@ -85,7 +79,7 @@ private unsafe bool InitCultureData()
8579 // It worked, note that the name is the locale name, so use that (even for neutrals)
8680 // We need to clean up our "real" name, which should look like the windows name right now
8781 // so overwrite the input with the cleaned up name
88- _sRealName = new String ( pBuffer , 0 , result - 1 ) ;
82+ _sRealName = new string ( pBuffer , 0 , result - 1 ) ;
8983 realNameBuffer = _sRealName ;
9084
9185 // Check for neutrality, don't expect to fail
@@ -125,7 +119,7 @@ private unsafe bool InitCultureData()
125119 }
126120 // We found a locale name, so use it.
127121 // In vista this should look like a sort name (de-DE_phoneb) or a specific culture (en-US) and be in the "pretty" form
128- _sSpecificCulture = new String ( pBuffer , 0 , result - 1 ) ;
122+ _sSpecificCulture = new string ( pBuffer , 0 , result - 1 ) ;
129123 }
130124 else
131125 {
@@ -168,8 +162,8 @@ private unsafe bool InitCultureData()
168162 }
169163
170164 // Wrappers around the GetLocaleInfoEx APIs which handle marshalling the returned
171- // data as either and Int or String .
172- internal static unsafe String GetLocaleInfoEx( String localeName , uint field )
165+ // data as either and Int or string .
166+ internal static unsafe string GetLocaleInfoEx( string localeName , uint field )
173167 {
174168 // REVIEW: Determine the maximum size for the buffer
175169 const int BUFFER_SIZE = 530 ;
@@ -178,13 +172,13 @@ internal static unsafe String GetLocaleInfoEx(String localeName, uint field)
178172 int resultCode = GetLocaleInfoEx( localeName , field , pBuffer , BUFFER_SIZE ) ;
179173 if ( resultCode > 0 )
180174 {
181- return new String ( pBuffer ) ;
175+ return new string ( pBuffer ) ;
182176 }
183177
184178 return null ;
185179 }
186180
187- internal static unsafe int GetLocaleInfoExInt ( String localeName , uint field )
181+ internal static unsafe int GetLocaleInfoExInt ( string localeName , uint field )
188182 {
189183 const uint LOCALE_RETURN_NUMBER = 0x20000000 ;
190184 field |= LOCALE_RETURN_NUMBER ;
@@ -255,27 +249,27 @@ private int GetFirstDayOfWeek()
255249 return ConvertFirstDayOfWeekMonToSun( result ) ;
256250 }
257251
258- private String [ ] GetTimeFormats ( )
252+ private string [ ] GetTimeFormats ( )
259253 {
260254 // Note that this gets overrides for us all the time
261255 Debug . Assert ( _sWindowsName != null , "[CultureData.DoEnumTimeFormats] Expected _sWindowsName to be populated by already" ) ;
262- String [ ] result = ReescapeWin32Strings( nativeEnumTimeFormats ( _sWindowsName , 0 , UseUserOverride ) ) ;
256+ string [ ] result = ReescapeWin32Strings( nativeEnumTimeFormats ( _sWindowsName , 0 , UseUserOverride ) ) ;
263257
264258 return result;
265259 }
266260
267- private String [ ] GetShortTimeFormats ( )
261+ private string [ ] GetShortTimeFormats ( )
268262 {
269263 // Note that this gets overrides for us all the time
270264 Debug . Assert ( _sWindowsName != null , "[CultureData.DoEnumShortTimeFormats] Expected _sWindowsName to be populated by already" ) ;
271- String [ ] result = ReescapeWin32Strings( nativeEnumTimeFormats ( _sWindowsName , TIME_NOSECONDS , UseUserOverride ) ) ;
265+ string [ ] result = ReescapeWin32Strings( nativeEnumTimeFormats ( _sWindowsName , TIME_NOSECONDS , UseUserOverride ) ) ;
272266
273267 return result;
274268 }
275269
276270 // Enumerate all system cultures and then try to find out which culture has
277271 // region name match the requested region name
278- private static CultureData GetCultureDataFromRegionName ( String regionName )
272+ private static CultureData GetCultureDataFromRegionName ( string regionName )
279273 {
280274 Debug . Assert ( ! GlobalizationMode . Invariant ) ;
281275 Debug. Assert ( regionName != null ) ;
@@ -365,7 +359,7 @@ private static string GetLocaleInfoFromLCType(string localeName, uint lctype, bo
365359 if ( result == null )
366360 {
367361 // Failed, just use empty string
368- result = String . Empty ;
362+ result = string . Empty ;
369363 }
370364
371365 return result;
@@ -385,7 +379,7 @@ private static string GetLocaleInfoFromLCType(string localeName, uint lctype, bo
385379 //
386380 // We don't build the stringbuilder unless we find something to change
387381 ////////////////////////////////////////////////////////////////////////////
388- internal static String ReescapeWin32String( String str )
382+ internal static string ReescapeWin32String( string str )
389383 {
390384 // If we don't have data, then don't try anything
391385 if ( str == null )
@@ -451,7 +445,7 @@ internal static String ReescapeWin32String(String str)
451445 return result. ToString ( ) ;
452446 }
453447
454- internal static String [ ] ReescapeWin32Strings ( String [ ] array )
448+ internal static string [ ] ReescapeWin32Strings ( string [ ] array )
455449 {
456450 if ( array != null )
457451 {
@@ -467,7 +461,7 @@ internal static String[] ReescapeWin32Strings(String[] array)
467461 // If we get a group from windows, then its in 3;0 format with the 0 backwards
468462 // of how NLS+ uses it (ie: if the string has a 0, then the int[] shouldn't and vice versa)
469463 // EXCEPT in the case where the list only contains 0 in which NLS and NLS+ have the same meaning.
470- private static int [ ] ConvertWin32GroupString ( String win32Str )
464+ private static int [ ] ConvertWin32GroupString ( string win32Str )
471465 {
472466 // None of these cases make any sense
473467 if ( win32Str == null || win32Str . Length == 0 )
@@ -569,9 +563,9 @@ private static unsafe Interop.BOOL EnumAllSystemLocalesProc(char* lpLocaleString
569563 }
570564
571565 // Context for EnumTimeFormatsEx callback.
572- private class EnumData
566+ private struct EnumData
573567 {
574- public StringList strings;
568+ public List < string > strings;
575569 }
576570
577571 // EnumTimeFormatsEx callback itself.
@@ -590,13 +584,13 @@ private static unsafe Interop.BOOL EnumTimeCallback(char* lpTimeFormatString, vo
590584 }
591585 }
592586
593- private static unsafe String [ ] nativeEnumTimeFormats( String localeName , uint dwFlags , bool useUserOverride )
587+ private static unsafe string [ ] nativeEnumTimeFormats( string localeName , uint dwFlags , bool useUserOverride )
594588 {
595589 const uint LOCALE_SSHORTTIME = 0x00000079 ;
596590 const uint LOCALE_STIMEFORMAT = 0x00001003 ;
597591
598592 EnumData data = new EnumData ( ) ;
599- data . strings = new StringList ( ) ;
593+ data . strings = new List < string > ( ) ;
600594
601595 // Now call the enumeration API. Work is done by our callback function
602596 Interop . Kernel32 . EnumTimeFormatsEx ( EnumTimeCallback , localeName , ( uint ) dwFlags , Unsafe . AsPointer ( ref data ) ) ;
@@ -649,7 +643,7 @@ private static unsafe string LCIDToLocaleName(int culture)
649643
650644 if ( length > 0 )
651645 {
652- return new String ( pBuffer) ;
646+ return new string ( pBuffer) ;
653647 }
654648
655649 return null ;
@@ -724,7 +718,7 @@ private static CultureInfo[] EnumCultures(CultureTypes types)
724718 }
725719
726720 EnumData context = new EnumData( ) ;
727- context. strings = new StringList ( ) ;
721+ context. strings = new List < string > ( ) ;
728722
729723 unsafe
730724 {
@@ -760,7 +754,7 @@ internal bool IsReplacementCulture
760754 get
761755 {
762756 EnumData context = new EnumData( ) ;
763- context. strings = new StringList ( ) ;
757+ context. strings = new List < string > ( ) ;
764758
765759 unsafe
766760 {
@@ -769,7 +763,7 @@ internal bool IsReplacementCulture
769763
770764 for ( int i= 0 ; i< context. strings. Count; i++ )
771765 {
772- if ( String . Compare( context. strings[ i] , _sWindowsName, StringComparison. OrdinalIgnoreCase) == 0 )
766+ if ( string . Compare( context. strings[ i] , _sWindowsName, StringComparison. OrdinalIgnoreCase) == 0 )
773767 return true;
774768 }
775769
0 commit comments