|
This C# example shows how to sort elements in a List. Sample Program that uses Sort [C#]
using System; using System.Collections.Generic;
class Program { static void Main() { List<string> list = new List<string>(); list.Add("Dog"); list.Add("BAT"); list.Add("AGE");
// Sort alphabetically, in ascending order (A - Z) list.Sort();
foreach (string value in list) { Console.WriteLine(value); } } }
Output
AGE BAT DOG
|