// 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.Collections.Generic; using System.Linq; namespace E { public class Program { public static void Main(string[] args) { List lst = new List{ 1,2,3,4,5,7,9,6,8 }; List lst2 = new List(lst); List lst3 = new List(lst); lst2.Sort(lst2.Count - 4, 4, null); List first = lst3.Take(lst3.Count - 4).ToList(); List last = lst3.Skip(lst3.Count - 4).ToList(); last.Sort(); lst3 = first.Concat(last).ToList(); for(int i = lst.Count - 4; i < lst.Count; i++) { Console.WriteLine("{0} {1} {2}", lst[i], lst2[i], lst3[i]); } } } }