How can you sort the elements of the array in descending
order?
Answers were Sorted based on User's Feedback
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 |
What is iformatprovider in c#?
Why are mutable structs evil?
Why do we need reflection in c#?
What is difference between string and stringbuilder in c#?
How to put assembly in gac?
What is Dispose method in .NET?
What is the meaning of console writeline in c#?
What are the different types of constructors in c#?
what is a static constructor?
How do you prevent a method from being overridden in c#?
What is the use of base keyword? Tell me a practical example for base keyword’s usage?
What is the difference between String s(Small s) and String S(Capital S)?