[Mono-list] Array.GetEnumerator()

Miguel de Icaza miguel@ximian.com
17 Mar 2002 21:22:57 -0500

> This code does not throw an exception with mscorlib.  I would think it
> should since I cannot find any exemption for Array's enumerator in the
> docs with respect to MoveNext() after a mutation.
> BTW, it doesn't throw for a single dimension array either.
> So either this is an undocumented "feature" or a bug.
> I'll implement the enumerator to mimic MS's behavior for now, and report
> this discrepancy to them.

Since arrays are fixed in size, this seems like the right behavior.  The
reason you want to throw exceptions in the case of change in some
collections is because guaranteeing that the enumerator will work across
modifications is something that might be too expensive.

In the case of a fixed array, there is no expense, so you could just as
well provide the "extra" benefit of allowing the collection data to