/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the exemplar characters for the given ICU locale.
        /// </summary>
        /// <param name="icuLocale">Code for the ICU locale.</param>
        /// <returns>
        /// string containing all the exemplar characters (typically only lowercase
        /// word-forming characters)
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public string  GetExemplarCharacters(string icuLocale)
        {
            ILgIcuResourceBundle rbExemplarCharacters = null;
            ILgIcuResourceBundle rbLangDef            = null;

            try
            {
                rbLangDef = LgIcuResourceBundleClass.Create();
                rbLangDef.Init(null, icuLocale);

                // if the name of the resource bundle doesn't match the LocaleAbbr
                // it loaded something else as a default (e.g. "en").
                // in that case we don't want to use the resource bundle so release it.
                if (rbLangDef.Name != icuLocale)
                {
                    return(string.Empty);
                }

                rbExemplarCharacters = rbLangDef.get_GetSubsection("ExemplarCharacters");
                return(rbExemplarCharacters.String);
            }
            finally
            {
                if (rbExemplarCharacters != null)
                {
                    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(rbExemplarCharacters);
                }

                if (rbLangDef != null)
                {
                    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(rbLangDef);
                }
            }
        }
        /// <summary>
        /// Determine whether the specified locale is a custom one the user is allowed to modify.
        /// </summary>
        /// <param name="localeId"></param>
        /// <returns></returns>
        public bool IsCustomLocale(string localeId)
        {
            ILgIcuResourceBundle rbroot = LgIcuResourceBundleClass.Create();

            try
            {
#if !__MonoCS__
                rbroot.Init(null, "en");
#else
                // TODO-Linux: fix Mono bug
                rbroot.Init("", "en");
#endif
                ILgIcuResourceBundle rbCustom = rbroot.get_GetSubsection("Custom");
                if (rbCustom != null)
                {
                    ILgIcuResourceBundle rbCustomLocales = rbCustom.get_GetSubsection("LocalesAdded");
                    Marshal.ReleaseComObject(rbCustom);
                    if (rbCustomLocales == null)
                    {
                        return(false);                        // Should never be.
                    }
                    while (rbCustomLocales.HasNext)
                    {
                        ILgIcuResourceBundle rbItem = rbCustomLocales.Next;
                        if (rbItem.String == localeId)
                        {
                            Marshal.ReleaseComObject(rbItem);
                            Marshal.ReleaseComObject(rbCustomLocales);
                            return(true);
                        }
                        Marshal.ReleaseComObject(rbItem);
                    }
                    Marshal.ReleaseComObject(rbCustomLocales);
                }
                // Now, compare the locale againt all known locales -- it may not exist at all yet!
                // If not, it is considered custom.
                ILgIcuLocaleEnumerator locEnum = LgIcuLocaleEnumeratorClass.Create();

                int cloc = locEnum.Count;
                for (int iloc = 0; iloc < cloc; iloc++)
                {
                    if (localeId == locEnum.get_Name(iloc))
                    {
                        Marshal.ReleaseComObject(locEnum);
                        return(false);
                    }
                }
                //Didn't find in either list...custom.
                Marshal.ReleaseComObject(locEnum);
                return(true);
            }
            finally
            {
                Marshal.ReleaseComObject(rbroot);
            }
        }