當前位置: 首頁>>代碼示例>>C#>>正文


C# CultureInfo.First方法代碼示例

本文整理匯總了C#中System.Globalization.CultureInfo.First方法的典型用法代碼示例。如果您正苦於以下問題:C# CultureInfo.First方法的具體用法?C# CultureInfo.First怎麽用?C# CultureInfo.First使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Globalization.CultureInfo的用法示例。


在下文中一共展示了CultureInfo.First方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TranslateName

        private string TranslateName(string code)
        {
            string nativeName = new CultureInfo(code).NativeName;
            string languageName = new CultureInfo(code).EnglishName;

            if (code != ApplicationData.Current.RoamingSettings.Values["primary"].ToString())
            { return nativeName.First().ToString().ToUpper() + nativeName.Substring(1) + " / " + languageName; }
            else
            { return nativeName; }
        }
開發者ID:diagonalwalnut,項目名稱:GodTools,代碼行數:10,代碼來源:Settings.xaml.cs

示例2: TranslateLanguage

        private string TranslateLanguage(Language language)
        {
            try
                {
                    if (language.code != CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
                    {
                        string uiLanguage = new CultureInfo(language.code).NativeName;

                        language.name = uiLanguage.First().ToString().ToUpper() + uiLanguage.Substring(1) + " / " + language.name;
                    }
                }
                catch (Exception exception)
                {
                    System.Diagnostics.Debug.WriteLine("Language Code does not exist.");

                    language.name = language.name + " (not found)";
                }

            return language.name;
        }
開發者ID:diagonalwalnut,項目名稱:GodTools,代碼行數:20,代碼來源:Languages.cs

示例3: TranslateLanguageList

        private IList<Language> TranslateLanguageList(string language, IList<Language> languageList)
        {
            foreach (Language item in languageList)
            {
                try
                {
                    if (item.code != CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
                    {
                        string uiLanguage = new CultureInfo(item.code).NativeName;

                        item.name = uiLanguage.First().ToString().ToUpper() + uiLanguage.Substring(1) + " / " + item.name;
                    }
                }
                catch (Exception exception)
                {
                    System.Diagnostics.Debug.WriteLine("Language Code does not exist.");

                    item.name = item.name + " (not found)";
                }
            }

            return languageList;
        }
開發者ID:diagonalwalnut,項目名稱:GodTools,代碼行數:23,代碼來源:Languages.cs


注:本文中的System.Globalization.CultureInfo.First方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。