EDIT Additional options and a slightly extended question below.
Consider this contrived and abstract example of a class body. It demonstrates four different w
With the exception of (C), which seems to read backwards to me, I can think of situations in which you might want to use each of the others. In addition, depending on what you are doing you could also throw in standard LINQ into the mix. For example, if your loop simply uses the list item to create some other object.
(E) var someOtherCollection = someList.Select( l => transform(l) );
For option (A), if you need to know the position in the list as well as the using the item. Option (B) or (E) would be what I would typically use. Option (D) makes sense if the list is large and the actions are amenable to being parallelized (no or manageable dependencies between the items).
Since you're using a generic list all but (E) are O(N). Count() should be an O(1) operation as it is kept internally in a variable. On other enumerable types, you'd need to know how the data structure is constructed. If you don't know the type of the collection, I'd use the foreach
implementation or LINQ over the indexed implementation since the collection may not be indexed and that could turn your enumeration into a O(N2) operation.