I want to set list cultureinfo in startup from database with query , please help me , how can i do that?
My Query
public IEnumerable<string> GetListLanguagesTypes()
{
var cul = (from n in _context.Language
select n.TypeLanguage).ToList();
return cul ;
}
My Code in Startup
var supportCulture = new List<CultureInfo>()
{
new CultureInfo("fa-IR"),
new CultureInfo("en-US"),
new CultureInfo("ru-RU"),
new CultureInfo("ar-SA")
};
i want to replace supportCulture from query
List<CultureInfo> supportCulture = (List<CultureInfo>)_language.GetListLanguagesTypes();
but i have a error
Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.Collections.Generic.List`1[System.Globalization.CultureInfo]'.'
You can try to use the following code:
Here is a demo:
action:
result: