Reverse
How do you return an array or list in reverse order? Linq has a Reverse
method. The Reverse method may come in handy when you need to re-order your array or list in reverse.
Basic example
We have a list of cities and using the Reverse
method, they will be returned in reverse order.
Live example: https://dotnetfiddle.net/yh6GTM
var cities = new[] { "Barcelona", "London", "Paris", "New York", "Moscow", "Amsterdam", "Tokyo", "Florence" };
var reverse = cities.Reverse();
// output: Florence, Tokyo, Amsterdam, Moscow, New York, Paris, London, Barcelona