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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a constant and a static readonly field?

520


Is system a class in c#?

482


Why var is used in c#?

487


What is assembly and dll in c#?

460


Why do we need reflection in c#?

480






What is serialization in dot net?

476


What's the difference between the debug class and trace class? Documentation looks the same.

500


What is distribute by in hive?

533


What are the types of access modifiers?

449


What is check/uncheck?

591


What is array collection?

488


What is difference between tostring() vs convert.tostring() vs (string) cast

538


Which attribute is used in order that the method can be used as webservice?

512


What is overriding in c#?

492


What is the difference between “dispose” and “finalize” variables in c#?

482