[Mono-list] Array.GetEnumerator()

Serge serge@wildwestsoftware.com
Fri, 8 Mar 2002 20:12:16 +0200

>> Notice I had to put in a version count in all the mutators. I hope this
>> doesn't mess up anything anyone else is working on.
> Huch, what is this good for ?

Versioning is needed to implement "fail-fast iterators".
If, say, one thread has enumerator and another thread modifies base
collection/array asynchronously, then it's better to notify thread 1 right
away by throwing InvalidOperation exception rather than introducing error
later in the code.
(Java collections framework has similar feature).