E
elvis_the_king
Hi all,
I am asking myself wheter IEnumerable has any inherent semantics? The
docs seem to be very unclear to me.
More specifically: When using a "foreach(...)" construct to enumerate a
Stack, Queue oder ArrayList using the IEnumerable interface - can I
safely make any assumptions about the order in which the elements are
returned? That is, LIFO for a Stack, FIFO for a queue and an order
corresponding to the indices when using an ArrayList?
Or does IEnumerable just guarantee that it will enumerate all elements
(with no specific, i. e. implementation-dependant order)?
TIA,
Matthias
I am asking myself wheter IEnumerable has any inherent semantics? The
docs seem to be very unclear to me.
More specifically: When using a "foreach(...)" construct to enumerate a
Stack, Queue oder ArrayList using the IEnumerable interface - can I
safely make any assumptions about the order in which the elements are
returned? That is, LIFO for a Stack, FIFO for a queue and an order
corresponding to the indices when using an ArrayList?
Or does IEnumerable just guarantee that it will enumerate all elements
(with no specific, i. e. implementation-dependant order)?
TIA,
Matthias