private void Resize()
        {
            var newsize    = FindNewSize();
            var newhashes  = new int[newsize];
            var newentries = new IocPerformanceDictionaryEntry[newsize];

            Array.Copy(entries, newentries, nextfree);

            for (int i = 0; i < newsize; i++)
            {
                newhashes[i] = -1;
            }

            for (int i = 0; i < nextfree; i++)
            {
                uint pos     = newentries[i].hashcode % newsize;
                int  prevpos = newhashes[pos];
                newhashes[pos] = i;

                if (prevpos != -1)
                {
                    newentries[i].next = prevpos;
                }
            }

            buckets = newhashes;
            entries = newentries;
        }
        public TValue this[TKey key]
        {
            get
            {
                uint pos           = (uint)key.GetHashCode() % (uint)buckets.Length;
                int  entryLocation = buckets[pos];

                if (entryLocation == -1)
                {
                    return(null);
                }

                int nextpos = entryLocation;

                do
                {
                    var entry = entries[nextpos];

                    if (key.Equals(entry.key))
                    {
                        return(entries[nextpos].value);
                    }

                    nextpos = entry.next;
                }while (nextpos != -1);

                return(null);
            }
            set
            {
                if (nextfree >= entries.Length)
                {
                    Resize();
                }

                uint hash          = (uint)key.GetHashCode();
                uint hashPos       = hash % (uint)buckets.Length;
                int  entryLocation = buckets[hashPos];
                int  storePos      = nextfree;

                if (entryLocation != -1)
                {
                    int currEntryPos = entryLocation;

                    do
                    {
                        var entry = entries[currEntryPos];
                        if (key.Equals(entry.key))
                        {
                            return;
                        }

                        currEntryPos = entry.next;
                    }while (currEntryPos > -1);

                    nextfree++;
                }
                else
                {
                    nextfree++;
                }

                buckets[hashPos]  = storePos;
                entries[storePos] = new IocPerformanceDictionaryEntry
                {
                    next     = entryLocation,
                    key      = key,
                    value    = value,
                    hashcode = hash
                };
            }
        }