Reputation: 12316
I tested this on both .Net 4.0 and .Net 4.0 CP, same result.
This line:
global::System.Globalization.CultureInfo.GetCultureInfo("en-us").Region
If I type it in Visual Studio (C#), then Visual Studio tells me "Region" isn't valid. If I type the same line in Immediate window during a breakpoint it is fully valid and returns data as expected. And from what I can see "Region" is not in the MSDN documentation.
Obviously two different objects for some reason.
Why? Whats happening here? Why is reality not consistent? I get scared!
(More seriously, I see behaviour I don't understand so I'd like to understand it.)
Immediate window returns:
global::System.Globalization.CultureInfo.GetCultureInfo("en-us").Region {US} CurrencyEnglishName: "US Dollar" CurrencyNativeName: "US Dollar" CurrencySymbol: "$" DisplayName: "United States" EnglishName: "United States" GeoId: 244 IsMetric: false ISOCurrencySymbol: "USD" Name: "US" NativeName: "United States" ThreeLetterISORegionName: "USA" ThreeLetterWindowsRegionName: "USA" TwoLetterISORegionName: "US"
While Visual Studio go all red on me:
Upvotes: 2
Views: 900
Reputation: 1055
Region is a non-public property of the CultureInfo class. It seems that the immediate window has access to it.
Upvotes: 3