You've quoted from 2 different examples there, and the behavior is
different... taking them separately:
In 2.0 you can use the List<T>.Sort(Comparison<T>) overload:
List<T> performs an unbalanced sort; there is no specific order to things
that match. You can add extra sorts, but short of introducing a row-index
(separately) there is no way of doing a balanced (matches listed in original
order) sort.
foreach (string s in list.OrderBy(s=>s.Length))
This is LINQ-to-Objects, which performs balanced sorts; so the order will
depend on the original order in the list. Obviously, if the LINQ query is
going to a different provider (LINQ-to-Foo), then it will be
provider-specific. If you want it sorted alphabetically, then you can append
a .ThenBy(), or use the alternative query langauge syntax.
Marc