本文整理汇总了C#中System.Globalization.CultureInfo.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# CultureInfo.GetHashCode方法的具体用法?C# CultureInfo.GetHashCode怎么用?C# CultureInfo.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.CultureInfo
的用法示例。
在下文中一共展示了CultureInfo.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PosTest2
public void PosTest2()
{
CultureInfo myCultureInfo = new CultureInfo("en");
// the only guarantee that can be made about HashCodes is that they will be the same across calls
int actualValue = myCultureInfo.GetHashCode();
int expectedValue = myCultureInfo.GetHashCode();
Assert.Equal(actualValue, expectedValue);
}
示例2: TestFrFRGetHashCode
public void TestFrFRGetHashCode()
{
TextInfo textInfoFrance = new CultureInfo("fr-FR").TextInfo;
TextInfo textInfoUS = new CultureInfo("en-US").TextInfo;
int franceHashCode = textInfoFrance.GetHashCode();
int usHashCode = textInfoUS.GetHashCode();
Assert.False(franceHashCode == usHashCode);
}
示例3: CultureAndRegionInfoBuilder
public CultureAndRegionInfoBuilder(CultureInfo templateCulture,
Object templateRegion,
String language, String region,
String suffix, CulturePrefix prefix)
#endif
{
if(templateCulture == null)
{
throw new ArgumentNullException("templateCulture");
}
if(templateRegion == null)
{
throw new ArgumentNullException("templateRegion");
}
// Copy the original property values out of the templates.
availableCalendars = templateCulture.OptionalCalendars;
consoleFallbackUICulture = templateCulture;
cultureName = templateCulture.Name;
dateTimeFormat = templateCulture.DateTimeFormat;
isNeutralCulture = templateCulture.IsNeutralCulture;
#if CONFIG_REFLECTION
lcid = templateCulture.LCID;
#else
lcid = templateCulture.GetHashCode();
#endif
numberFormat = templateCulture.NumberFormat;
parent = templateCulture.Parent;
textInfo = templateCulture.TextInfo;
#if CONFIG_FRAMEWORK_1_2
keyboardLayoutID = templateCulture.KeyboardLayoutID;
//lineOrientation = templateCulture.LineOrientation; // TODO
#endif
#if CONFIG_REFLECTION
cultureEnglishName = templateCulture.EnglishName;
cultureNativeName = templateCulture.NativeName;
threeLetterISOLanguageName =
templateCulture.ThreeLetterISOLanguageName;
threeLetterWindowsLanguageName =
templateCulture.ThreeLetterWindowsLanguageName;
twoLetterISOLanguageName =
templateCulture.TwoLetterISOLanguageName;
#endif
#if !ECMA_COMPAT
#if CONFIG_FRAMEWORK_2_0
geoId = templateRegion.GeoId;
#else
geoId = templateRegion.GetHashCode();
#endif
#if CONFIG_FRAMEWORK_2_0
currencyEnglishName = templateRegion.CurrencyEnglishName;
currencyNativeName = templateRegion.CurrencyNativeName;
#endif
currencySymbol = templateRegion.CurrencySymbol;
isMetric = templateRegion.IsMetric;
isoCurrencySymbol = templateRegion.ISOCurrencySymbol;
regionEnglishName = templateRegion.EnglishName;
regionName = templateRegion.Name;
regionNativeName = templateRegion.DisplayName;
threeLetterISORegionName =
templateRegion.ThreeLetterISORegionName;
threeLetterWindowsRegionName =
templateRegion.ThreeLetterWindowsRegionName;
twoLetterISORegionName =
templateRegion.TwoLetterISORegionName;
#endif
// Override the names if necessary.
String prefixValue;
if(prefix == CulturePrefix.IANA)
{
prefixValue = "i-";
}
else if(prefix == CulturePrefix.PrivateUse)
{
prefixValue = "x-";
}
else
{
prefixValue = "";
}
if(language == null || language.Length == 0)
{
language = cultureName;
}
cultureName = prefixValue + language + suffix;
#if CONFIG_REFLECTION
cultureEnglishName = cultureName;
cultureNativeName = cultureName;
#endif
#if !ECMA_COMPAT
if(region == null || region.Length == 0)
{
region = regionName;
}
regionName = prefixValue + region + suffix;
regionEnglishName = regionName;
regionNativeName = regionName;
#endif
}