Home > other >  Why are certain cultures missing from CultureInfo.GetCultures(CultureTypes.AllCultures)?
Why are certain cultures missing from CultureInfo.GetCultures(CultureTypes.AllCultures)?

Time:06-26

When I run the code below, I can create two valid cultures that are not returned in CultureInfo.GetCultures(CultureTypes.AllCultures). Why is this the case and why are those cultures missing? I am running on Windows 10 using .NET 4.6.1

var allCultureNamesHashSet = new HashSet<string>(CultureInfo.GetCultures(CultureTypes.AllCultures).Select(ci => ci.Name));
var ci1 = new CultureInfo("sr-Cyrl-CS");
var ci2 = new CultureInfo("sr-Latn-CS");
var b1 = allCultureNamesHashSet.Contains(ci1.Name); //false
var b2 = allCultureNamesHashSet.Contains(ci2.Name); //false

CodePudding user response:

From Microsoft:

See https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/dd997383(v=vs.100)?redirectedfrom=MSDN#new-specific-cultures

  • Related