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);
}