.NET Framework - Supported cultures on an OS? CultureInfo.GetCultures won't work...

Asked By Alain Dekker on 11-May-11 11:14 AM

I am running a C# app on Windows CE using the Compact Framework v2.

The following is the code that I found from Googling to get the supported
cultures on the OS:
string specName = string.Empty;
string strName = string.Empty;
string strEngName = string.Empty;
foreach (CultureInfo ci in
try { specName = CultureInfo.CreateSpecificCulture(ci.Name).Name; }
catch { }
strName = ci.Name;
strEngName = ci.EnglishName;

This works fine on Windows XP or higher, but "GetCultures" is not a
supported method on the CF v2 (code will not compile). This MSDN documentation
page says that it *is* supported (see right at bottom):


There is a little caveat in that article "The .NET Framework does not
support all versions of every platform".

Not sure why its not supported. In any case, is it posible to enumerate the
list of supported cultures if I cannot use "GetCultures"?


Peter Duniho replied to Alain Dekker on 11-May-11 10:11 PM
That documentation is for the enumeration passed to the method, not the
method itself.

The method itself is in fact documented on MSDN as not being available
for CF 2.0.

The first link from Bing, excluding a copy of your post and the two MSDN
doc pages you already know about, provides one answer:


It uses p/invoke (you can ignore the second answer on that page???I have
no idea how it got voted up to 2 votes, given that it does not answer the
question at all).  it is possible there is a pure managed solution
available on the Compact Framework, but of course a CF-specific
newsgroup would be a better place to ask questions like that if you want
something more than what a simple web search could get you.