c# - foreach inversly -
is there posible way make foreach iterate through collection end begining?
int[] fibarray = new int[] { 0, 1, 2, 3, 5, 8, 13 }; foreach (int in fibarray) { system.console.writeline(i); } how display inversly foreach ?
using system.linq; foreach (int in fibarray.reverse()) but normal loop more efficient:
for( int index = fibarray.length - 1; index >= 0; --index ) { int = fibarray[index]; ... }
Comments
Post a Comment