Reputation: 974
I'm writing a C# Windows Universal app that needs to be able to detect if the contents of a StorageFolder has changed. This app will not run continuously so I do not believe I can use change notifications.
When I wrote this app in .NET using C#, I used the DirectoryInfo class and use the LastWriteTime property.
In Windows Universal, is there a way to check the last time a StorageFolder was changed? Or, is there a smarter way to check if the folder contents have changed when an app starts up?
Upvotes: 1
Views: 60
Reputation: 11228
You can use StorageFolder.GetBasicPropertiesAsync
, then BasicProperties.DateModified
:
var basicProperties = await folder.GetBasicPropertiesAsync();
var dateModified = basicProperties.DateModified;
Upvotes: 2