How do I order a string array ascending and descending alphabetically? C# .NET or Java -


well, have string array:

string array[] = new string[5];  array[0]="abc"; array[1]="aab"; array[2]="aaacb   sf"; array[3]="  ab"; array[4]="hello"; 

how order ascending , descending?

using linq, do:

array = array.orderby(d => d).toarray(); 

to sort ascending

and

array = array.orderbydescending(d => d).toarray(); 

to sort descending

remember add using system.linq;.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -