// 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 { private static void Dump(Dictionary> data) { foreach(KeyValuePair> entry in data) { Console.WriteLine(entry.Key + ":"); foreach(string name in entry.Value) { Console.WriteLine(" " + name); } } } public static void Main(string[] args) { Dictionary> data = new Dictionary>(); data.Add("Piger", new List { "Sofie", "Charlotte", "Helle" }); data.Add("Drenge", new List { "Hans", "Jørgen" }); Dump(data); data.Keys.ToList().ForEach(key => data[key].Remove("Helle")); Dump(data); } } }