I very often encounter an error stating that " Collection was modified after the enumerator was instantiated ".
I have many collections ( Sorted Dictionaries ) in my code and often I loop through the collection ( not removing or adding items just looping through the elements ) while it is being updated in OnRender().
I had many foreach() loops that I changed for while() loops ( GetEnumerator() ) knowing that foreach() loops can cause problems but I am still facing this problem.
What do you recommend I should do ?
Thank you for your help.
Comment