uwp roaming data sample

C#
ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;

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

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

Also in C#: