Is it safe to delete from SortedList during iteration
- by Captain Comic
Hi,
My question is is it safe for enumerator to remove item from SortedList?
SortedList<decimal, string> myDictionary;
// omitted code
IEnumerator<decimal, string> enum = myDictionary.GetEnumerator();
while(enum.MoveNext)
{
// is it ok to remove here?
myDictionary.Remove(enum.Current.Key);
}