System.Globalization.TextInfo.GetCaseInsensitiveHashCode C# (CSharp) Метод

GetCaseInsensitiveHashCode() приватный Метод

private GetCaseInsensitiveHashCode ( String str ) : int
str String
Результат int
        internal unsafe int GetCaseInsensitiveHashCode(String str) {
            // This must be called to guarantee m_pNativeTextInfo is initialized.
            // The reason is that the order of calling OnDeserializtion on dependent
            // objects are not guaranteed, so a class using
            // TextInfo class (Hashtable is an example) will have problems in
            // its deserializtion process if methods of TextInfo class is called in the
            // deserialization process.
            //

            if (str==null) 
            {
                 throw new ArgumentNullException("str");
            }

            if (m_pNativeTextInfo == null)
            {
                OnDeserialized();
            }

            // This is the fix to avoid introduce
            // a dependency on mscorlib.dll and mscorwks.dll, which the real fix needs.
            // By doing this, we will do uppercase twice for Turkish/Azeri, so it is slower
            // in these two cultures.  The benefit is that we only have to do the fix in the managed side.
            switch (m_textInfoID)
            {
                case 0x041f:    // Turkish
                case 0x042c:    // Azeri
                    // Uppercase the specified characters.
                    str = nativeChangeCaseString(m_textInfoID, m_pNativeTextInfo, str, true);
                    break;
            }
            return (nativeGetCaseInsHash(str, m_pNativeTextInfo));
            // A better fix is to exam the m_wing32LangID and the high-char state in the native side to decide if we can do "fast hashing".
            //return nativeGetCaseInsHash(m_textInfoID, str, m_pNativeTextInfo);

        }

Usage Example

Пример #1
0
        //
        // Internal ordinal comparison functions
        //

        internal static int GetHashCodeOrdinalIgnoreCase(String s)
        {
            // This is the same as an case insensitive hash for Invariant
            // (not necessarily true for sorting, but OK for casing & then we apply normal hash code rules)
            return(Invariant.GetCaseInsensitiveHashCode(s));
        }
All Usage Examples Of System.Globalization.TextInfo::GetCaseInsensitiveHashCode