In what order does a C# for each loop iterate over a List?
Basically it’s up to the IEnumerator implementation – but for a List<T> it will always go in the natural order of the list, i.e. the same order as the indexer: list[0], list[1], list[2] etc. I don’t believe it’s explicitly documented – at least, I haven’t found such documentation – but I think you can treat … Read more