// 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; namespace E { public class Program { public static void Main(string[] args) { List stringList = new List(); List intList = new List(); stringList.Add("c"); stringList.Add("b"); stringList.Add("a"); intList.Add(3); intList.Add(9); intList.Add(2); for(int i = 0; i < stringList.Count; i++) { Console.WriteLine(stringList[i] + " " + intList[i]); } string[] stringArray = stringList.ToArray(); int[] intArray = intList.ToArray(); Array.Sort(stringArray, intArray); stringList = new List(stringArray); intList = new List(intArray); for(int i = 0; i < stringList.Count; i++) { Console.WriteLine(stringList[i] + " " + intList[i]); } } } }