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


C# CultureInfo.Equals方法代碼示例

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


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

示例1: TestDiffCultureTextInfo

        public void TestDiffCultureTextInfo()
        {
            TextInfo textInfoFrance = new CultureInfo("fr-FR").TextInfo;
            TextInfo textInfoUS = new CultureInfo("en-US").TextInfo;

            Assert.False(textInfoFrance.Equals((object)textInfoUS));
        }
開發者ID:qskycolor,項目名稱:corefx,代碼行數:7,代碼來源:TextInfoEquals.cs

示例2: TestIntObject

 public void TestIntObject()
 {
     TextInfo textInfoUS = new CultureInfo("en-US").TextInfo;
     int i = TestLibrary.Generator.GetInt32(-55);
     object intObject = i as object;
     Assert.False(textInfoUS.Equals(intObject));
 }
開發者ID:qskycolor,項目名稱:corefx,代碼行數:7,代碼來源:TextInfoEquals.cs

示例3: TestStringObject

        public void TestStringObject()
        {
            TextInfo textInfoUS = new CultureInfo("en-US").TextInfo;
            String str = TestLibrary.Generator.GetString(-55, false, _MINI_STRING_LENGTH, _MAX_STRING_LENGTH);
            object strObject = str as object;

            Assert.False(textInfoUS.Equals(strObject));
        }
開發者ID:qskycolor,項目名稱:corefx,代碼行數:8,代碼來源:TextInfoEquals.cs

示例4: CulturesEqual

 private static bool CulturesEqual(CultureInfo refCI, CultureInfo defCI)
 {
     bool flag = defCI.Equals(CultureInfo.InvariantCulture);
     if ((refCI == null) || refCI.Equals(CultureInfo.InvariantCulture))
     {
         return flag;
     }
     return (!flag && defCI.Equals(refCI));
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:9,代碼來源:RuntimeAssembly.cs

示例5: FindMissingProperty

        public string FindMissingProperty(PropertyToken property, CultureInfo culture)
        {
            var defaultValue = culture.Equals(_defaultCulture)
                ? property.Header ?? property.DefaultHeaderText(culture) ?? BreakUpCamelCase(property.PropertyName)
                : property.DefaultHeaderText(culture) ?? culture.Name + "_" + property.PropertyName;

            writeMissing(property.StringTokenKey, defaultValue, culture);

            return defaultValue;
        }
開發者ID:modulexcite,項目名稱:dovetail-bootstrap,代碼行數:10,代碼來源:BootstrapLocalizationMissing.cs

示例6: Compatible

 private static bool Compatible(XmlLanguage lang, CultureInfo culture)
 {
     if (lang == null || lang == XmlLanguage.Empty) return true;
     var ll = lang.IetfLanguageTag.ToLowerInvariant();
     while (!culture.Equals(CultureInfo.InvariantCulture))
     {
         if (ll == culture.IetfLanguageTag.ToLowerInvariant()) return true;
         culture = culture.Parent;
     }
     return false;
 }
開發者ID:AlissaSabre,項目名稱:UnicodeInspector,代碼行數:11,代碼來源:FontFamilyMapper.cs

示例7: FindMissingText

        public string FindMissingText(StringToken key, CultureInfo culture)
        {
            var defaultValue = culture.Name + "_" + key.Key;
            if (key.DefaultValue.IsNotEmpty() && culture.Equals(_defaultCulture))
            {
                defaultValue = key.DefaultValue;
            }

            _storage.WriteMissing(key.Key, defaultValue, culture);

            return defaultValue;
        }
開發者ID:schotime,項目名稱:fubucore,代碼行數:12,代碼來源:LocalizationMissingHandler.cs

示例8: FindMissingText

        public string FindMissingText(StringToken key, CultureInfo culture)
        {
            var defaultValue = culture.Name + "_" + key.ToLocalizationKey();
            if (key.DefaultValue.IsNotEmpty() && culture.Equals(_defaultCulture))
            {
                defaultValue = key.DefaultValue;
            }

            writeMissing(key.ToLocalizationKey().ToString(), defaultValue, culture);

            return defaultValue;
        }
開發者ID:modulexcite,項目名稱:dovetail-bootstrap,代碼行數:12,代碼來源:BootstrapLocalizationMissing.cs

示例9: GetLocalizer

		public Localizer GetLocalizer (CultureInfo culture)
		{
			Localizer loc = LookupLocalizer(culture);
			if (loc == null)
				lock (_localizers.SyncRoot)
				{
					loc = LookupLocalizer(culture);
					if (loc == null)
					{
						if (culture.Equals(_defaultculture))
							loc = CreateDefaultLocalizer();
						else if (culture.IsNeutralCulture || culture.Equals(CultureInfo.InvariantCulture))
							loc = CreateLocalizer(culture, _defaultculture);
						else
							loc = CreateLocalizer(culture, culture.Parent);

						CacheLocalizer(culture, loc);
					}
				}
			return loc;
		}
開發者ID:versionone,項目名稱:VersionOne.Localization,代碼行數:21,代碼來源:LocalizationManager.cs

示例10: CultureInfoScope

 public CultureInfoScope(CultureInfo cultureInfo)
 {
     if (cultureInfo != null && !cultureInfo.Equals(Thread.CurrentThread.CurrentCulture))
     {
         if (cultureInfo.IsNeutralCulture)
         {
             cultureInfo = LanguageHelper.GetSpecificCultureInfo(cultureInfo);
         }
         originalCultureInfo = Thread.CurrentThread.CurrentCulture;
         Thread.CurrentThread.CurrentCulture = cultureInfo;
     }
 }
開發者ID:kenlefeb,項目名稱:SpecFlow,代碼行數:12,代碼來源:CultureInfoScope.cs

示例11: GetCultureInfoName

        private string GetCultureInfoName(CultureInfo ci)
        {
            CultureInfo en_US = new CultureInfo("en-US");

            // For "English (United States)" we'd rather just display "English"
            if (ci.Equals(en_US))
            {
                return GetCultureInfoName(ci.Parent);
            }
            else
            {
                return ci.NativeName;
            }
        }
開發者ID:nkaligin,項目名稱:paint-mono,代碼行數:14,代碼來源:HelpMenu.cs

示例12: GetClosestMatchingLanguage

        private CultureInfo GetClosestMatchingLanguage(CultureInfo culture)
        {
            if(culture == null || culture.Equals(CultureInfo.InvariantCulture)) {
                return null;
            }

            var cultures = _cultureProvider.GetSupportedCultures.ToList();

            var specificCulture = cultures.FirstOrDefault(c => c.IsSameCultureAs(culture));
            var neutralCulture = cultures.FirstOrDefault(c => c.IsSameLanguageAs(culture));
            var fallBackCulture = culture.IsSameLanguageAs(FallbackCulture) ? FallbackCulture : null;

            return specificCulture ?? neutralCulture ?? fallBackCulture;
        }
開發者ID:ZS,項目名稱:i18n-patterns,代碼行數:14,代碼來源:CultureSelector.cs

示例13: GetLocalizerByCulture

 /// <summary>
 /// Returns a localizer instance based on the culture.
 /// </summary>
 internal BaseLocalizer GetLocalizerByCulture(CultureInfo ci)
 {
     if (customLocalizer != null)
         return customLocalizer;
     
     if (ci.Equals(FarsiCulture))
     {
         return fa;
     }
     
     if (ci.Equals(ArabicCulture))
     {
         return ar;
     }
     
     return en;
 }
開發者ID:mukhtiarlander,項目名稱:git_demo_torit,代碼行數:20,代碼來源:FALocalizeManager.cs

示例14: GetCultureSpecifiedFile

 /// <summary>
 /// 返回與特定區域性相關的文件名。
 /// </summary>
 /// <param name="path">文件的路徑。</param>
 /// <param name="fileName">文件的名稱。</param>
 /// <param name="culture">要獲取的文件的區域性信息。</param>
 /// <returns>與特定區域性相關的文件名,如果不存在則為 <c>null</c>。</returns>
 /// <remarks>與特定區域性相關的文件名,其形式為 path/culture.Name/fileName。</remarks>
 /// <exception cref="ArgumentNullException"><paramref name="path"/>、<paramref name="fileName"/> 或 
 /// <paramref name="culture"/> 為 <c>null</c>。</exception>
 /// <exception cref="ArgumentException"><paramref name="path"/> 或 <paramref name="fileName"/> 
 /// 中包含一個或多個無效字符。</exception>
 public static string GetCultureSpecifiedFile(string path, string fileName, CultureInfo culture)
 {
     CommonExceptions.CheckArgumentNull(path, "path");
     CommonExceptions.CheckArgumentNull(fileName, "fileName");
     CommonExceptions.CheckArgumentNull(culture, "culture");
     Contract.EndContractBlock();
     while (true)
     {
         string filePath = Path.Combine(path, culture.Name, fileName);
         if (File.Exists(filePath))
         {
             return filePath;
         }
         if (culture.Equals(CultureInfo.InvariantCulture))
         {
             break;
         }
         culture = culture.Parent;
     }
     return null;
 }
開發者ID:GISwilson,項目名稱:Cyjb,代碼行數:33,代碼來源:FileExt.cs

示例15: TryGetSatteliteAssembly

        public static bool TryGetSatteliteAssembly(this Assembly assembly, CultureInfo culture,
            out Assembly satteliteAssembly)
        {
            Contract.Requires(assembly != null);
            Contract.Requires(culture != null);

            if (culture.Equals(CultureInfo.InvariantCulture))
            {
                satteliteAssembly = assembly;
                return true;
            }
            try
            {
                satteliteAssembly = assembly.GetSatelliteAssembly(culture);
            }
            catch
            {
                satteliteAssembly = null;
                return false;
            }
            return true;
        }
開發者ID:nholling,項目名稱:essential-templating,代碼行數:22,代碼來源:StorageExtensions.cs


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