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
What is the difference between a constant and a static readonly field?
Is system a class in c#?
Why var is used in c#?
What is assembly and dll in c#?
Why do we need reflection in c#?
What is serialization in dot net?
What's the difference between the debug class and trace class? Documentation looks the same.
What is distribute by in hive?
What are the types of access modifiers?
What is check/uncheck?
What is array collection?
What is difference between tostring() vs convert.tostring() vs (string) cast
Which attribute is used in order that the method can be used as webservice?
What is overriding in c#?
What is the difference between “dispose” and “finalize” variables in c#?