GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int
예제 #1
0
        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
0
        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
0
        /// <summary>Returns true if <c>o</c> is equal to this.  If a
        /// <see cref="FieldComparatorSource" /> (deprecated) or <see cref="Search.Parser" />
        /// was provided, it must properly
        /// implement hashCode (unless a singleton is always
        /// used).
        /// </summary>
        public override int GetHashCode()
        {
            int hash = type ^ 0x346565dd + (reverse ? Boolean.TrueString.GetHashCode() : Boolean.FalseString.GetHashCode()) ^ unchecked ((int)0xaf5998bb);

            if (field != null)
            {
                hash += (field.GetHashCode() ^ unchecked ((int)0xff5685dd));
            }
            if (locale != null)
            {
                hash += (locale.GetHashCode() ^ 0x08150815);
            }
            if (comparatorSource != null)
            {
                hash += comparatorSource.GetHashCode();
            }
            if (parser != null)
            {
                hash += (parser.GetHashCode() ^ 0x3aaf56ff);
            }
            return(hash);
        }
예제 #4
0
파일: sysglobl.cs 프로젝트: ForNeVeR/pnet
        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
        }
예제 #5
0
	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
			}