Click here to Skip to main content
12,950,272 members (68,419 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Please help to solve this case:
There is a project that needs to accept the total number of array elements and values from the user. It also needs to arrange the array elements in ascending order, and display the result. (Hint: The array should be an integer array). How to write the code in C#?

-Question by Sun_Shine.. :-D
Posted 7-Mar-11 19:06pm
Updated 8-Mar-11 6:17am
Marcus Kramer 8-Mar-11 16:48pm
You should do your own homework first, Sun_Shine, and then ask questions specific to issues that arise. You'll be a much better developer in the long run if you fight through issues first and not try to get others to do it for you.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have a look at the array.sort method:[^]
or see this link with a lot of samples:[^]
Espen Harlinn 13-Mar-11 8:53am
Nice and simple, my 5
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

int[] array = new int[] { 3, 1, 4, 5, 2 };

//Declare Array

Array.Sort<int>( array );

// Sort Method used Asending Order

Array.Reverse( array );

// reverse Method used Decenting Order
ThePhantomUpvoter 20-Apr-13 10:57am
You are only 2 years too late to do the OP's homework for them.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,829
CHill60 3,460
Maciej Los 2,953
Jochen Arndt 1,975
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100