C# Program to Reverse the List of Cities using LINQ Last Updated : 09 Dec, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Given a list of city names, we need to reverse the list of cities and this can be done using the reverse() method in LINQ. The Reverse() method reverses the sequence of the elements in the specified list. it is available in both Queryable and Enumerable classes. It will return an ArgumentNullException if the given source is null. Syntax: public static void Reverse ();Example: Input : ["mumbai", "pune", "bangalore", "hyderabad"] Output : ["hyderabad", "bangalore", "pune", "mumbai"] Input : ["chennai", "vizag", "delhi"] Output : ["delhi", "vizag", "chennai"]Approach: A list of cities is defined using arrayList.The list of cities is reverse using the Reverse() method.cities.Reverse();Finally resultant array is printed using the foreach loop.foreach (var city in cities) { Console.Write(city + " "); } C# using System; using System.Linq; using System.Collections.Generic; class geek { static void Main(string[] args) { List<string> cities = new List<string>() {"mumbai","hyderabad","pune","bangalore"}; // reversing the cities arrayList cities.Reverse(); Console.Write("The Reversed list = "); Console.Write("[ "); foreach (var city in cities) { Console.Write(city + " "); } Console.Write(" ]"); } } OutputThe Reversed list = [ bangalore pune hyderabad mumbai ] Comment More infoAdvertise with us Next Article C# Program to Join Multiple Data Sources using LINQ P pulamolusaimohan Follow Improve Article Tags : C# C# Programs CSharp LINQ Similar Reads C# Program to Find the Index of Even Numbers using LINQ Given an array, now our task is to find the index value of the even numbers present in the given array using LINQ. LINQ is known as Language Integrated Query and was introduced in .NET 3.5. It gives the power to .NET languages to generate queries to retrieve data from the data source. So to do this 2 min read C# Program to Check a Specified City Exists in the List Collection using LINQ Given a list, we need to check if a specified city exists in the given list using LINQ. So we can do this task using contains() method. This method is used to check whether a sequence contains a specified element or not. The method overloads in the following ways: Contains<TSource>(IEnumerable 3 min read C# Program to Join Multiple Data Sources using LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It provides the ability to .NET languages to create queries to retrieve data from the data source. In this article, we will discuss how to join multiple data sources using LINQ. Here data source means list. So we are using 4 min read C# Program to Sort a List of String Names Using the LINQ OrderBy() Method Given a list of string names, now our task is to sort the names given in the list using the OrderBy() method of LINQ. This method is used to sort the elements in the collection in ascending order. While using this method in the LINQ query you don't need to add an extra condition to sort the list in 2 min read C# Program to Sort Student Names in Descending Order using LINQ Given a list of student names, now our task is to sort the names given in the list in descending order using the LINQ, This task can be done using OrderByDescending() method of LINQ. This method is used to sort the elements in the collection in descending order. While using this method in the LINQ q 2 min read C# Program to Find the Negative Double Numbers From the List of Objects Using LINQ Given a list of objects, we need to find the negative double from the list of objects, this task can be done using the OfType() method along with the Where() method. OfType() method is used to filter the elements of an IEnumerable based on a specified type. Or in other words, this method is used to 2 min read Like