IT Community - Software Programming, Web Development and Technical Support

How can you sort the elements of the array in descending order In C#. NET 2005?

This is a discussion on How can you sort the elements of the array in descending order In C#. NET 2005? within the C# Programming forums, part of the Software Development category; How can you sort the elements of the array in descending order In C#. NET 2005?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-24-2007, 12:32 AM
Archer Archer is offline
D-Web Programmer
 
Join Date: Jun 2007
Posts: 52
Archer is on a distinguished road
Question How can you sort the elements of the array in descending order In C#. NET 2005?

How can you sort the elements of the array in descending order In C#. NET 2005?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-24-2007, 12:33 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: How can you sort the elements of the array in descending order In C#. NET 2005?

We can sort the arrays by using Array.Sort() method and we can inverse it by using the Array.Reverse() method. Here is the code to do the job.
string[] myValues = { "strawberries", "PEARS", "LIMES", "BERRIES", "grapes", "olives", "cantaloupe" };
Array.Sort(myValues);
Array.Reverse(myValues);
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort object array? raja C# Programming 4 03-14-2008 09:52 PM
Selecting data's by order S.Vinothkumar Database Support 3 09-27-2007 03:12 AM
Duplicate elements from an array vigneshgets C and C++ Programming 1 09-06-2007 08:04 AM
What are order of precedence and associativity, and how are they used? anbuchezhians Java Programming 1 08-01-2007 11:53 PM
How to sort the datagrid columns in ascending order and decending order using c# dot? Archer C# Programming 1 07-22-2007 11:28 PM


All times are GMT -7. The time now is 10:27 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0