System.Data.DataTable.GetSpecialHashCode C# (CSharp) Method

GetSpecialHashCode() private method

private GetSpecialHashCode ( string name ) : int
name string
return int
        internal int GetSpecialHashCode(string name)
        {
            int i;
            for (i = 0; (i < name.Length) && (0x3000 > name[i]); ++i) ;

            if (name.Length == i)
            {
                if (null == _hashCodeProvider)
                {
                    // it should use the CaseSensitive property, but V1 shipped this way
                    _hashCodeProvider = StringComparer.Create(Locale, true);
                }
                return _hashCodeProvider.GetHashCode(name);
            }
            else
            {
                return 0;
            }
        }

Usage Example

Example #1
0
        internal int IndexOfCaseInsensitive(string name)
        {
            int hashcode = _table.GetSpecialHashCode(name);
            int cachedI  = -1;

            for (int i = 0; i < Count; i++)
            {
                DataColumn column = (DataColumn)_list[i] !;
                if ((hashcode == 0 || column._hashCode == 0 || column._hashCode == hashcode) &&
                    NamesEqual(column.ColumnName, name, false, _table.Locale) != 0)
                {
                    if (cachedI == -1)
                    {
                        cachedI = i;
                    }
                    else
                    {
                        return(-2);
                    }
                }
            }
            return(cachedI);
        }
DataTable