public List <Bonregel> Parse(string filePath) { List <string> lines = File.ReadAllLines(filePath).ToList(); List <Bonregel> parseBon = new List <Bonregel>(); foreach (var line in lines) { string[] entries = line.Split(','); Bonregel newLine = new Bonregel(); newLine.Product = entries[0]; newLine.Bedrag = decimal.Parse(entries[1]); parseBon.Add(newLine); } return(parseBon); }
public string Addprod(List <Bonregel> receipt) { string product; Console.WriteLine("Geeft product op: "); product = Console.ReadLine(); Console.WriteLine("Geef bedrag op: "); decimal bedrag = decimal.Parse(Console.ReadLine()); var regel = new Bonregel(); regel.Bedrag = bedrag; regel.Product = product; receipt.Add(regel); return(product + bedrag); }