uwp roaming data sample 1

uwp roaming data sample

ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;

roamingSettings.Values["lastViewed"] = DateTime.Now;

var lastViewed = (DateTime)roamingSettings.Values["lastViewed"];

Here is what the above code is Doing:
1. We’re creating a new ApplicationDataContainer object called roamingSettings.
2. We’re adding a new key/value pair to the roamingSettings object. The key is “lastViewed” and the value is the current date and time.
3. We’re retrieving the value of the “lastViewed” key and storing it in a variable called lastViewed.

Similar Posts