2024年1月14日发(作者:)
freeCount = 0;
version++; }
} ():从 Dictionary
if (buckets != null) {
int hashCode = hCode(key) & 0x7FFFFFFF;
int bucket = hashCode % ; int last = -1;
for (int i = buckets[bucket]; i >= 0; last = i, i = entries[i].next) { if (entries[i].hashCode == hashCode && (entries[i].key, key)) { if (last < 0) { buckets[bucket] = entries[i].next;
} else {
entries[last].next = entries[i].next;
} entries[i].hashCode = -1;
entries[i].next = freeList; entries[i].key = default(TKey); entries[i].value = default(TValue); freeList = i;
freeCount++; version++;
return true;
} }
} return false; } merator():返回循环访问 Dictionary
} [Serializable]
public struct Enumerator: IEnumerator
{
private Dictionary
private int index; private KeyValuePair
internal Enumerator(Dictionary
version = n; index = 0; meratorRetType = getEnumeratorRetType; current = new KeyValuePair
} public bool MoveNext() {
if (version != n) { nvalidOperationException(dOperation_EnumFailedVersion);
} // Use unsigned comparison since we set index to +1 when the enumeration ends. // +1 could be negative if is ue
while ((uint)index < (uint)) { if (s[index].hashCode >= 0) {
current = new KeyValuePair
index++; return true;
} index++; } index = + 1; current = new KeyValuePair
/// 要添加的键/值 public void Add(KeyValuePair


发布评论