public List <Employee> LoadDataViaCsv(List <Employee> employeeList) { //Clear list and load content from csv file employeeList.Clear(); // retrieve path of data from config file string databasePath = ConfigurationManager.AppSettings["CsvDatabasePath"]; // string databasePath = @"C:\Users\CodeNation 3\source\repos\WebAPIDemoApp\DemoAPI\DataStore\Employees.csv"; var line = File.ReadAllLines(databasePath); foreach (var x in line) { if (string.IsNullOrEmpty(x)) { break; } var values = x.Split(','); int employeeId = Convert.ToInt32(values[0]); string firstName = values[1]; string lastName = values[2]; string stringDOB = values[3]; // convert DOB string to a DateTime object DateTime DOB = DateConvertor.StringToDateObject(stringDOB); string stringStartDate = values[4]; DateTime startDate = DateConvertor.StringToDateObject(stringStartDate); string homeTown = values[5]; string department = values[6]; Employee newEmployee = new Employee(employeeId, firstName, lastName, DOB, startDate, homeTown, department); employeeList.Add(newEmployee); } return(employeeList); //ShowMenu(employeeList); }