从Windows 8移植到Windows Phone

时间:2012-05-10 19:44:50

标签: c# windows-phone-7 windows-8 windows-runtime isolatedstorage

我正在尝试将应用从Windows 8移植到Windows Phone 7,并且很难找到这些行的等价物

var localFolder = ApplicationData.Current.LocalFolder;
IReadOnlyList<StorageFile> fileList = await localFolder.GetFilesAsync();

它从localFolder获取所有文件并将其保存在fileList

我可以使用

在Windows Phone上执行此操作
string[] fileList = appStorage.GetFileNames();

其中appStorageIsolatedStorageFile的实例。但是,如果我使用上面的代码行,我就不能对列表中的文件使用某些函数,比如我想获取文件的创建日期,我可以使用file.DateCreated <在WinRT中执行此操作/ p>

1 个答案:

答案 0 :(得分:3)

如果appStorage是IsolatedStorageFile类型,则使用GetCreationTime方法http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.getcreationtime.aspx