Esempio n. 1
0
        public int IndexOf(T item)
        {
            var cacheIndex = _cache.IndexOf(item, Comparer);

            if (cacheIndex >= 0)
            {
                return(cacheIndex);
            }
            var index = _cache.Count - 1;
            var found = false;

            Progressor.While
            (
                input =>
            {
                index++;
                if (Comparer.Equals(input, item))
                {
                    found = true;
                    return(false);
                }
                return(true);
            }
            ).Consume();
            if (found)
            {
                return(index);
            }
            return(-1);
        }
Esempio n. 2
0
 public T this[int index]
 {
     get
     {
         if (index >= _cache.Count)
         {
             Progressor.While(() => _cache.Count < index + 1).Consume();
         }
         return(_cache[index]);
     }
 }
Esempio n. 3
0
 public void CopyTo(KeyValuePair <TKey, IGrouping <TKey, T> >[] array, int arrayIndex, int countLimit)
 {
     Extensions.CanCopyTo(array, arrayIndex, countLimit);
     _progressor.While(() => _cache.Count < countLimit).Consume();
     _cache.CopyTo(array, arrayIndex, countLimit);
 }
Esempio n. 4
0
 public void CopyTo(T[] array, int arrayIndex, int countLimit)
 {
     Extensions.CanCopyTo(array, arrayIndex, countLimit);
     _progressor.While(() => _cache.Count < countLimit).Consume();
     _cache.CopyTo(array, arrayIndex, countLimit);
 }