// 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.IO; using System.Collections.Generic; namespace E { public class Data { public string V1 { get; set; } public decimal V2 { get; set; } } public class Program { public static List Find(string fnm, string v0) { List res = new List(); using(StreamReader sr = new StreamReader(fnm)) { string line; while((line = sr.ReadLine()) != null) { string[] flds = line.Split(';'); if(flds.Length == 3 && flds[0] == v0) { res.Add(new Data { V1=flds[1], V2=decimal.Parse(flds[2]) }); } } } return res; } public static void Main(string[] args) { foreach(Data d in Find(@"C:\test.csv", "20")) { Console.WriteLine(d.V1 + " " + d.V2); } } } }