private static void Main() { var persons = new Indexed <PersonIndexedObjects>( new IndexMaker <PersonIndexedObjects, string>("name", delegate(PersonIndexedObjects p) { return(p.Name); }), new IndexMaker <PersonIndexedObjects, int>("year", delegate(PersonIndexedObjects p) { return(p.Date / 10000); }), new IndexMaker <PersonIndexedObjects, int>("day", delegate(PersonIndexedObjects p) { return(p.Date % 100); }), new IndexMaker <PersonIndexedObjects, string>("month", delegate(PersonIndexedObjects p) { return(_months[p.Date / 100 % 100 - 1]); }) ); persons.Add(new PersonIndexedObjects("Niels", 19470206)); persons.Add(new PersonIndexedObjects("Lone", 19600810)); persons.Add(new PersonIndexedObjects("Peter", 19620625)); persons.Add(new PersonIndexedObjects("Carsten", 19640627)); persons.Add(new PersonIndexedObjects("Hanne", 19641209)); persons.Add(new PersonIndexedObjects("Dorte", 19660930)); persons.Add(new PersonIndexedObjects("Dorte", 19610312)); persons.Add(new PersonIndexedObjects("J�rgen", 19340930)); persons.Add(new PersonIndexedObjects("Kirsten", 19360114)); persons.Add(new PersonIndexedObjects("Henrik", 19360630)); persons.Add(new PersonIndexedObjects("Lars", 19640625)); persons.Add(new PersonIndexedObjects("Thora", 19091129)); Console.WriteLine("Born in 1964:"); foreach (var p in persons["year"][1964]) { Console.WriteLine(p); } Console.WriteLine("Born in June:"); foreach (var p in persons["month"]["Jun"]) { Console.WriteLine(p); } Console.WriteLine("Named Dorte:"); foreach (var p in persons["name"]["Dorte"]) { Console.WriteLine(p); } Console.WriteLine(persons); }