W
Wilfried Mestdagh
Hi,
does foreach guarantees the sequence order starting from index 0 ?
does foreach guarantees the sequence order starting from index 0 ?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Brian said:Wilfried,
foreach uses an IEnumerator returned by the collection. So it depends
on how the IEnumerator is implemented and who provided it.
In the case of an array, ArrayList, or List<T> then yes. The order is
defined by the index in the collection.
Which collection are you referring to?
Brian

Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.