public bool GetData(Tkey key, out Tvalue data, out int count)
        {
            count = 0;
            data  = default(Tvalue);
            var proxyKey = new ProxyKey <Tkey>(key);
            var hash     = GetHashCode(proxyKey);

            while (true)
            {
                ProxyKey <Tkey> currentKey;

                try
                {
                    currentKey = Entries[hash].Key;
                }


                catch
                {
                    return(false);
                }

                if (currentKey.Key.Equals(key))
                {
                    count = currentKey.Count + 1;
                    data  = Entries[hash].Data;
                    return(true);
                }
                proxyKey.Count++;
                hash = GetHashCode(proxyKey);
            }
        }
Beispiel #2
0
 public Entry(Tkey key, Tvalue data)
 {
     Data = data;
     Key  = new ProxyKey <Tkey>(key);
 }
        private int GetHashCode(ProxyKey <Tkey> key)
        {
            var result = key.GetHashCode() % capacity;

            return(result);
        }