// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Linq; using System.Collections.Generic; namespace E { public class User { public int Age { get; set; } } public class Program { public static void Main(string[] args) { List users = new List(); users.Add(new User { Age = 37 } ); users.Add(new User { Age = 39 } ); users.Add(new User { Age = 32 } ); foreach(User u in users) { Console.WriteLine(u.Age); } users.Sort((u1,u2) => u1.Age - u2.Age); foreach(User u in users) { Console.WriteLine(u.Age); } } } }