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 use of 'using' statement in c#?
What is strongly typed in c#?
What is executereader in c#?
If dll and exe files are same it means you can deploy both the files in gac?
What is the difference between a function and a method?
Can abstract class be sealed in c#?
How to add a readonly property in c#.net
What is public or shared assemblies ?
Explain what a diffgram, and a good use for one Define diffgram? How it be used?
Is datetime value type c#?
How do I open the console window?
Is comparable a functional interface?
Why constructor is used in c#?
Okay, so an int is a value type, and a class is a reference type. How can int be derived from object?
I have 3 overloaded constructors in my class. In order to avoid making instance of the class do I need to make all constructors to private?