Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // v4.8.1.78 06-Oct-2018 -JpE-
- // Perfected v4.9.4.90 27-Nov-2018
- private void SortListByLastAccess()
- {
- PFS.Default.SortByAccess = false;
- var sortThese = listBox1.Items
- .Cast<string>().ToList();
- var info = sortThese.Select(
- str => new FileInfo(str)).ToList();
- var sorted = info.OrderBy(
- x => x.LastAccessTime).ToList();
- var list = sorted.Select(fileInfo =>
- fileInfo.FullName).ToList();
- var date = sorted.Select(fileInfo =>
- fileInfo.LastAccessTime).ToList();
- var c = list.Count;
- var list1 = new Collection<string>();
- var date1 = new Collection<string>();
- for (var i = c-1; i >= 0; --i)
- { list1.Add(list[i]);
- date1.Add(Convert.ToString(date[i])); }
- listBox1.Items.Clear();
- foreach (var file in list1)
- listBox1.Items.Add(file);
- GetSelected();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement