Implement CSV reading in CreateListFromCsv method

This commit is contained in:
MarcUs7i 2025-01-15 22:16:05 +01:00
parent 02ff071ebe
commit 63d956d7c1

View file

@ -27,6 +27,16 @@ return;
static ExamList CreateListFromCsv(string fileName)
{
var testList = new ExamList();
// TODO read CSV file
var lines = File.ReadAllLines(fileName);
// Skip header line
for (int i = 1; i < lines.Length; i++)
{
var columns = lines[i].Split(';');
var date = DateTime.ParseExact(columns[4], "dd.MM.yy", null);
var exam = new Exam(columns[2], date, columns[3]);
testList.Insert(exam);
}
return testList;
}