views:

33

answers:

1

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?

+8  A: 

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

tonio
thanks, tonio. After your indication I found http://msdn.microsoft.com/en-us/library/2s4xk11f.aspx
serhio