locked
Custom Culture Verification RRS feed

  • Question

  • User1221987322 posted

    We can register and unregister new cultures using CultureAndRegionInfoBuilder class. Is there a way we can verify if the custom culture has already been created?

     I know we can technically verify if the .nlp file has been created in the globalization folder or access the registry however am not comfortable with that approach. So, does .NET2.0 offer a way to verify if a custom culture exists?

     Thanks,

    Chintu

    Friday, September 14, 2007 8:56 PM

All replies

  • User1221987322 posted

     The nearest solution I have received so far is:

     

     private static bool CustomCultureExists(string cultureName)

    {


    CultureInfo
    [] customCultures = CultureInfo.GetCultures(CultureTypes.UserCustomCulture);

          foreach (CultureInfo ci in customCultures)

          {

                if (ci.Name.ToUpper() == cultureName.ToUpper())

                {

                      return true;

                }

    }

    return false;

    }

    Monday, September 17, 2007 1:25 PM