object IDictionary.this [object key] {
get {
- if (!(key is TKey))
- return null;
- else
- return this [(TKey)key];
+ TValue obj;
+ if (key is TKey && TryGetValue ((TKey)key, out obj))
+ return obj;
+ return null;
}
set {
void ICollection<KeyValuePair<TKey, TValue>>.Clear ()
{
- defaultCapacity = INITIAL_SIZE;
- this.table = new KeyValuePair<TKey, TValue> [defaultCapacity];
- inUse = 0;
- modificationCount++;
+ Clear ();
}
public void Clear ()
{
- defaultCapacity = INITIAL_SIZE;
- this.table = new KeyValuePair<TKey, TValue> [defaultCapacity];
+ Array.Clear (table, 0, table.Length);
inUse = 0;
modificationCount++;
}
int right = len-1;
while (left <= right) {
- int guess = (left + right) >> 1;
+ int guess = left + ((right - left) >> 1);
int cmp = Compare (table[guess].Key, key);
if (cmp == 0) return guess;