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 iformatprovider in c#?

0 Answers  


Why are mutable structs evil?

0 Answers  


Why do we need reflection in c#?

0 Answers  


What is difference between string and stringbuilder in c#?

0 Answers  


How to put assembly in gac?

0 Answers  


What is Dispose method in .NET?

3 Answers  


What is the meaning of console writeline in c#?

0 Answers  


What are the different types of constructors in c#?

0 Answers  


what is a static constructor?

0 Answers  


How do you prevent a method from being overridden in c#?

0 Answers  


What is the use of base keyword? Tell me a practical example for base keyword’s usage?

0 Answers  


What is the difference between String s(Small s) and String S(Capital S)?

4 Answers  


Categories