示例#1
0
        /// <summary>
        /// Removes the item at the specified index.
        /// </summary>
        ///
        /// <exception cref="IndexOutOfRangeException">
        /// Thrown when the index is outside the bound of the current set.
        /// </exception>
        ///
        /// <param name="index">
        /// Zero-based index of the item to remove.
        /// </param>

        public void RemoveAt(int index)
        {
            if (index >= Count || Count == 0)
            {
                throw new IndexOutOfRangeException("Index out of range");
            }

            T item = OrderedList.ElementAt(index);

            MutableList.Remove(item);
            MutableListOrdered.Remove(item);
            Touch();
        }
示例#2
0
        /// <summary>
        /// Removes the given item from the SelectionSet
        /// </summary>
        ///
        /// <param name="item">
        /// The item to remove.
        /// </param>
        ///
        /// <returns>
        /// true if it succeeds, false if it fails.
        /// </returns>

        public bool Remove(T item)
        {
            if (MutableList.Remove(item))
            {
                MutableListOrdered.Remove(item);
                Touch();
                return(true);
            }
            else
            {
                return(false);
            }
        }