示例#1
0
 /// <summary>
 /// Clears the items in the enumerator
 /// </summary>
 public void Dispose()
 {
     _head    = null;
     _current = null;
     if (_cache != null)
     {
         _cache.CollectionChanged -= Cache_CollectionChanged;
     }
     _cache = null;
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheEnumerator{TKey, TValue}"/> class
        /// </summary>
        /// <param name="cache">Cache to which this enumerator belongs</param>
        /// <param name="head">First item in the list</param>
        public CacheEnumerator(LruCache <TKey, TValue> cache, Node <TKey, TValue> head)
        {
            if (head == null)
            {
                throw new ArgumentException("Head can't be null");
            }
            if (cache != null)
            {
                _cache = cache;
                cache.CollectionChanged += Cache_CollectionChanged;
            }

            _head    = head;
            _current = null;
        }