Пример #1
0
        /// <summary>Removes the element at the specified index of the list.</summary>
        /// <param name="index">The zero-based index of the element to remove.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">
        ///     index is less than 0 -or-
        ///     index is equal to or greater than Count.
        /// </exception>
        public void RemoveAt(int index)
        {
            Check.InRange(index, 0, Count, "index is less than 0 -or- index is greater than Count.",
                          nameof(index));

            var removed = _list[index];
            var success = EventsEnabled ? BeforeRemoval.Call(this, index, removed, true) : true;

            if (success)
            {
                _list.RemoveAt(index);
                if (EventsEnabled)
                {
                    Removed.Call(this, index, removed);
                }
            }
        }