I want to delete the selected Item from the ListBox. Code:
SearchPath.Items.Remove(SearchPath.Items[SearchPath.SelectedIndex]); or
System.Collections.IList selectedItems = SearchPath.SelectedItems; if (selectedItems.Count != 0) { for (int i = selectedItems.Count - 1; i >= 0; i--) SearchPath.Items.Remove(selectedItems[i]); } It does not work because the original collection is in use.
At work, they said to remove directly from the model. How much is this correct and why, then, is the Remove method?