Does a LinkedList Foreach element get in order?

Does a Foreach Item on LinkedList provide items in a strict order?

Is the strict order First=>Next=>Next=>...=>Last respected in foreach, or maybe it is better to use while (item != null) ... item = item.Next ?

+4
source share
1 answer

Yes Yes. See http://msdn.microsoft.com/en-us/library/aa664754(VS.71).aspx and how the LinkedList enumerator respects order.

+8
source

Source: https://habr.com/ru/post/1301425/


All Articles