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 a console device?

0 Answers  


Explain About multi level and multiple inheritance how to achieve in .net

0 Answers  


What is the difference between firstordefault and first?

0 Answers  


Why do I get a "cs5001: does not have an entry point defined" error when compiling?

0 Answers  


How do I make a dll in c#?

0 Answers  






Any .net training centers available near hitech city , hyderabad?

2 Answers  


What is difference between list and ilist in c#?

0 Answers  


What is default boolean value in c#?

0 Answers  


What is the difference between icomparer and icomparable in c#?

0 Answers  


What are the basics of c#?

0 Answers  


How more than one version of an assembly can keep in same place?

0 Answers  


What is the difference between list and array in c#?

0 Answers  


Categories