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

Why we use delegates in c#?

0 Answers  


What is the namespcae generally given to the webpage of the .NET Framework ?

0 Answers   Siebel,


Explain About Global.asax

0 Answers   Keane India Ltd,


What is the purpose of c#?

0 Answers  


What are partial types in c#?

0 Answers  






Is null c# operator?

0 Answers  


How to add controls dynamically to the form using c#.net.

0 Answers  


Explain concurrency with aop?

0 Answers  


What is the wildcard character in SQL? Let?s say you want to query database with LIKE for all employees whose name starts with La.

1 Answers  


What is the syntax for calling an overloaded constructor within a constructor?

0 Answers  


Can we declare class as protected?

0 Answers   Infosys,


Can we have multiple threads in one app domain?

0 Answers  


Categories