Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望文件夹中的子文件夹在树视图控件中按月排列。Treeview 控件用于列出目录中的所有子文件夹。由于 treeview 根据 Windows 资源管理器获取子文件夹,但有什么方法可以按月对其进行排序。
据我了解,将您的树视图分配给此数据源
var sortedDirs = from dirDate in ( from dir in Directory.GetDirectories(BASEDIR) select new { Dir = dir, Date = Directory.GetCreationTime(dir) }) orderby dirDate.Date.Month select dirDate.Dir;