How to sort array elements in descending order in C#?

 Posted by Senthilns2005 on 6/1/2011 | Category: C# Interview questions | Views: 20299 | Points: 40
Answer:

int[] array = new int[] { 3, 1, 4, 5, 2 };


//Declare Array

Array.Sort<int>( array );

// Sort Method used Asending Order

Array.Reverse( array );

// reverse Method used Decenting Order


Source: Accenture Interview Question | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Akiii on: 6/1/2011 | Points: 10
good one...

Thanks and Regards
Akiii
Posted by: Kulygin on: 1/24/2013 | Points: 10
Array.Sort(array, (x,y)=>y-x);

Login to post response

More Interview Questions by Senthilns2005