I am trying to get files from a directory where, latest created files or modified files should be on top of the grid view, I tried this OrderByDescending but not helpful
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Results/"));
List<Thing> lst = new List<Thing>();
foreach (string filePath in filePaths)
{
string filename = Path.GetFileNameWithoutExtension(filePath);
string dateformat = filename.Substring(0, 10);
lst.Add(new Thing() { FileDate = filename.Split('_')[0], FileName =
filename.Split('_')[1], FilePath = filePath });
}
GridView1.DataSource = lst;
GridView1.DataBind();