我想在C#的Metro应用程序中获取日期顺序的文件列表
我认为这段代码应该这样做,
var queryOptions = new QueryOptions(CommonFileQuery.OrderByDate, new[] { ".xml" });
queryOptions.FolderDepth = FolderDepth.Deep;
StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Recent", CreationCollisionOption.OpenIfExists);
StorageFileQueryResult query = folder.CreateFileQueryWithOptions(queryOptions);
var files = await query.GetFilesAsync();
但这给了我以下错误:
WinRT information: The requested enumeration option is not available
for this folder because it is not within a library or homegroup. Only folders within a library or a homegroup support all enumeration options.
有没有办法从Local文件夹中的目录中读取文件时按日期顺序获取文件列表?
最佳答案 您可以恢复文件,然后使用LINQ to Objects为您执行排序.