Listnumbers = new List (){ 1, 2, 3, 4, 5 }; numbers.Reverse(); // Output: [5, 4, 3, 2, 1]
ListIn this example, we create a List of strings containing various fruits. We then call the Reverse() method on the List, which reverses the order of the fruits in the List. Overall, the List Reverse method is a useful tool for manipulating collections of data in C#.fruits = new List () { "Apple", "Banana", "Cherry", "Durian" }; fruits.Reverse(); // Output: [ "Durian", "Cherry", "Banana", "Apple" ]