I have a text file imported and stored in a string array which looks like:
firstname, lastname, middlename, D/O/B, gender
firstname, lastname, middlename, D/O/B, gender
firstname, lastname, middlename, D/O/B, gender
etc etc etc
I want to sort the file by the DOB (studentFile[3]) but cannot get the app to read the array by datetime. This is what I have so far
var dateOrder = studentFile.OrderByDescending(x => DateTime.Parse(x.Split(',')[4]));
foreach (var date in dateOrder)
{
Console.WriteLine("\t" + date);
}
Any ideas on where I'm going wrong and how to correct it?