// 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 Data { public int A { get; set; } public string B { get; set; } } public class Program { public static void Main(string[] args) { List lst = new List(); lst.Add(new Data { A=123, B="ABC" }); lst.Add(new Data { A=456, B="DEF" }); Data d123 = lst.Find(d => d.A==123); Console.WriteLine(d123.B); Data ddef = lst.Find(d => d.B=="DEF"); Console.WriteLine(ddef.A); } } }