What is the most efficient way to delete all selected items in a ListViewItem collection
- by Andrew
My user is able to select multiple items in a ListView collection that is configured to show details (that is, a list of rows).
What I want to do is add a Delete button that will delete all of the selected items from the ListViewItem collection associated with the ListView.
The collection of selected items is available in ListView.SelectedItems, but ListView.Items doesn't appear to have a single method that lets me delete the entire range. I have to iterate through the range and delete them one by one, which will potentially modify a collection I'm iterating over.
Any hints?
Edit: What I'm basically after is the opposite of AddRange().