There's no need, assuming _listInternal
is in fact a List<T>
. The List
enumerator already implements this functionality; its enumerator will throw an exception if you mutate the collection while iterating it, and that exception will propagate up through your iterator block.
If your iterator block is based on an underlying collection that doesn't already have this behavior, or there is mutable state besides just some underlying collection that you use, but that cannot change, then you may want to use this pattern, yes.
Of course, in order to be able to implement this pattern you need to have some way of incrementing the version number when the underlying data is changed. Sometimes, if you're using a collection you don't have control over the code for, you just can't do that.