Ejemplo n.º 1
0
 /// <summary>
 /// 获取Key的HashCode的值,因为Key的HashCode值有可能是负数所有与0x7FFFFFFF进行与操作确保hashcode值为正数
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public int InitialHashCode(TKey key)
 {
     return((key == null) ? 0 : comparer.GetHashCode(key) & 0x7FFFFFFF);
 }