From c2a64e90b97ac344d3fefd19219bc3e1a5ae0fe0 Mon Sep 17 00:00:00 2001 From: Petr Onderka Date: Wed, 20 Jul 2016 21:44:38 +0200 Subject: [PATCH] Move RegionNames out of #ifs For example, with this change new RegionInfo("GB").NativeName correctly returns the English name "United Kingdom", instead of the Welsh name "Y Deyrnas Unedig". --- src/mscorlib/src/System/Globalization/CultureData.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mscorlib/src/System/Globalization/CultureData.cs b/src/mscorlib/src/System/Globalization/CultureData.cs index 8316f46..5ca27fe 100644 --- a/src/mscorlib/src/System/Globalization/CultureData.cs +++ b/src/mscorlib/src/System/Globalization/CultureData.cs @@ -186,7 +186,6 @@ namespace System.Globalization private bool bFramework; // Flags for indicate if the culture is one of Whidbey cultures #endif -#if !FEATURE_CORECLR // Region Name to Culture Name mapping table // (In future would be nice to be in registry or something) @@ -334,8 +333,6 @@ namespace System.Globalization } private volatile static Dictionary s_RegionNames; -#endif - ///////////////////////////////////////////////////////////////////////// // Build our invariant information // @@ -761,10 +758,10 @@ namespace System.Globalization } } -#if !FEATURE_CORECLR // // Not found in the hash table, look it up the hard way // +#if !FEATURE_CORECLR #if FEATURE_WIN32_REGISTRY // First try the registry in case there are overrides of our table try @@ -798,6 +795,7 @@ namespace System.Globalization catch (ObjectDisposedException) { } catch (ArgumentException) { } #endif // FEATURE_WIN32_REGISTRY +#endif // !FEATURE_CORECLR // If not a valid mapping from the registry we'll have to try the hard coded table if (retVal == null || (retVal.IsNeutralCulture == true)) @@ -809,7 +807,7 @@ namespace System.Globalization retVal = GetCultureData(RegionNames[cultureName], useUserOverride); } } -#endif // !FEATURE_CORECLR + // If not found in the hard coded table we'll have to find a culture that works for us if (retVal == null || (retVal.IsNeutralCulture == true)) { -- 2.7.4