Does Foreach Item
in LinkedList
give items in strict order?
Is the strict order First=>Next=>Next=>...=>Last
respected in foreach or maybe is better to use while (item != null) ... item = item.Next
?
Does Foreach Item
in LinkedList
give items in strict order?
Is the strict order First=>Next=>Next=>...=>Last
respected in foreach or maybe is better to use while (item != null) ... item = item.Next
?
Yes, it does. See http://msdn.microsoft.com/en-us/library/aa664754(VS.71).aspx and how LinkedList enumerator respects the order.