I have this code, when I try to get not existed culture I get exception.
Is there exists method like TryGetCultureInfo, which return bool value? I don’t want to use try-catch statement
CultureInfo culture = CultureInfo.GetCultureInfo(cultureCode);
if (culture == null)
{
culture = CultureInfo.GetCultureInfo(DefaultCultureCode);
}
I think there’s no such method. So you could just
try-catchor check all installed cultures:But i would prefer the
try-catch, i’m sure it is more efficient.