public List <Person> ReadPeople(string fileName) { string[] allData = File.ReadAllLines(fileName); var people = allData .Select(line => CSVStringToPersonConverter.Convert(line)); return(people.ToList()); }
public List <Person> ReadPeople(string fileName) { using var reader = new StreamReader(fileName); string data = reader.ReadToEnd(); string[] lines = data.Split( new [] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries ); var people = lines .Select(line => CSVStringToPersonConverter.Convert(line)); return(people.ToList()); }