Tue, 17 Jul 2001 00:52:11 -0700 (PDT)
IEnumerator.MoveNext() has to throw
InvalidOperationException if the object it's
enumerating is modified in any way. I tested this
with MS's implementation of BitArray, and it seems to
really detect *any* change to the original object.
Maybe my brain is fried, but I can't seem to think
of a great way to implement this. The best way I can
think of is to have the original object keep a change
count. Whenever any call modifies the object,
increment the count. The IEnumerator will store
the value on creation, then check it every time you
This works in all cases except when you modify
something 4 billion times before calling MoveNext.
Does anyone have a cleaner idea? I can't keep
to all the IEnumerators, because then they'd never
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail