当前位置: 首页>>代码示例>>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;未经允许,请勿转载。