c# iterate through a list in reverse order
C#[Edit]
+
0
-
0
c# iterate through a List in reverse order
1 2 3 4List<string> myList = new List<string> { "A", "B", "C" }; for (int i = myList.Count - 1; i >= 0; i--) Console.WriteLine(myList[i]);
[Edit]
+
0
-
0
c# iterate through a List in reverse order
1 2 3 4 5 6List<string> myList = new List<string> { "A", "B", "C" }; myList.Reverse(); foreach (string item in myList) Console.WriteLine(item);
[Edit]
+
0
-
0
c# iterate through a List in reverse order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19using System; using System.Collections.Generic; public class Program { public static void Main() { List<string> myList = new List<string> { "A", "B", "C" }; for (int i = myList.Count - 1; i >= 0; i--) Console.WriteLine(myList[i]); } } // Output: // C // B // A
[Edit]
+
0
-
0
c# iterate through a List in reverse order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22using System; using System.Collections.Generic; public class Program { public static void Main() { List<string> myList = new List<string> { "A", "B", "C" }; myList.Reverse(); foreach (string item in myList) { Console.WriteLine(item); } } } // Output: // C // B // A