public virtual void RemoveRange(int index, int toIndex)
        {
            int num = 0;

            Sharpen.Iterator iterator = this.Iterator();
            while (num <= index)
            {
                if (!iterator.HasNext())
                {
                    throw new IndexOutOfRangeException();
                }
                iterator.Next();
                num++;
            }
            if (index < toIndex)
            {
                iterator.Remove();
            }
            for (num = index + 1; num < toIndex; num++)
            {
                if (!iterator.HasNext())
                {
                    throw new IndexOutOfRangeException();
                }
                iterator.Next();
                iterator.Remove();
            }
        }
Exemple #2
0
 public virtual U Remove(object key)
 {
     Sharpen.Iterator <U> iterator = EntrySet() as Sharpen.Iterator <U>;
     if (iterator == null)
     {
         throw new NotSupportedException();
     }
     while (iterator.HasNext())
     {
         U local = iterator.Next();
         if (local.Equals((T)key))
         {
             iterator.Remove();
             return(local);
         }
     }
     return(default(U));
 }
        public virtual T Remove(int index)
        {
            if (index < 0)
            {
                throw new IndexOutOfRangeException();
            }
            int    num  = 0;
            object item = null;

            Sharpen.Iterator iterator = this.Iterator();
            while (num <= index)
            {
                if (!iterator.HasNext())
                {
                    throw new IndexOutOfRangeException();
                }
                item = iterator.Next();
                num++;
            }
            iterator.Remove();
            return((T)item);
        }