.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> LINQ >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

GenericList Sort Descending

Posted By:Syed Shakeer Hussain       Posted Date: December 19, 2011    Points: 40    Category: LINQ    URL: http://www.dotnetspark.com  

Following shows you how to Sort Generic List in Descending order
 

List<int> li = new List<int> {10, 1, 2, 3, 4, 5, 6 };

Console.WriteLine("Descending Generic List");

li.Reverse();

foreach (int rev in li)

{

 Console.WriteLine("{0}", rev);

}

OutPut:

Descending Generic List

10

6

5

4

3

2

1



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend