c# - Changing Foreach Order? -


is there anyway foreach through list end beginning rather beginning end (preferably without reordering list).

using system.linq;  foreach(var item in source.reverse()) {     ... } 

edit: there 1 more step if dealing list<t>. class defines own reverse method signature not same enumerable.reverse extension method. in case, need "lift" variable reference ienumerable<t>:

using system.linq;  foreach(var item in list.asenumerable().reverse()) {     ... } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -