How can you sort the elements of the array in descending
order?

Answers were Sorted based on User's Feedback



How can you sort the elements of the array in descending order?..

Answer / anubhav gupta

int[] arr = new int[4];
arr[0] = 22;
arr[1] = 33;
arr[2] = 11;
arr[3] = 44;
Array.Sort(arr);//First sort the array in accending
order
Array.Reverse(arr);//then do reverse of array for
descending order
foreach (int a in arr)
{
Response.Write(a+"--");
}

Is This Answer Correct ?    4 Yes 0 No

How can you sort the elements of the array in descending order?..

Answer / swapna

By calling Sort() and Reverse() methods we can sort the
elements in descending order.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What is base class in c#?

0 Answers  


Can hashtable have duplicate keys in c#?

0 Answers  


What are cshtml files?

0 Answers  


What does void do in c#?

0 Answers  


Why we use methods in c#?

0 Answers  






Which class comes after the SortedList class?

0 Answers   Siebel,


Can interface inherit class in c#?

0 Answers  


How do I open the console window?

0 Answers  


Explain how to parse a datetime string?

0 Answers  


What is the difference between static class and sealed class in c#?

0 Answers  


Is it possible to nest cfml conditional tags?

0 Answers   HCL,


What is class sortedlist underneath?

0 Answers  


Categories