by Michael S. Kaplan, published on 2008/04/29 10:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2008/04/29/8436742.aspx
John's question was:
Experimentally, it seems that CultureInfo.GetCultureInfo() returns a CultureInfo object which has UseUserOverrides set to false. Is this always the case? I couldn’t infer from the documentation that this is actually guaranteed.
Thanks,
-john
This takes me way back to when Mike first wrote the code for GetCultureInfo (the link to his description is here, but don't bother clicking on it since the neither the blog nor the Blog are there anymore).
The problem was that CultureInfo objects are pretty freaking huge. And the cost to keep creating them (even creating the same one over and over again) was way too big. Since most of the time they were being created only for things like resource loading, where most of the properties weren't even being used.
In case this sounds familiar, it is something I previously mentioned as one of the problems with CurrentUICulture, here.
Anyway, it was pointed out that in many of these case, a single shared read-only instance would do just as well. And so that is what CultureInfo.GetCultureInfo returns: a cached, read-only instance of a culture.
Now from there, the issue of user overrides is an important one.
Because the notion of a read-only object which nevertheless can have its behavior changed by changes one makes in Regional and Language Options is kind of a stupid sort of read only.
In fact, as read-only goes, that behavior (to borrow from Cartman's lexicon) would really kind of suck ass....
So the decision was made to make the cached cultures returned by CultureInfo.GetCultureInfo always have the useUserOverride set to false.
I'll mention other interesting features of GetCultureInfo in another blog, soon....
This blog brought to you by ျ (U+103b, aka MYANMAR CONSONANT SIGN MEDIAL YA)