c# - Saving a DateTime value to Local Settings [UWP] -


in uwp app i'm trying save datetime value local settings code:

        localsettings.values["date"] = mydate; 

the problem when try retrieve value cast error. i'm using code retrieve value:

    datetime daterecovered = (datetime)localsettings.values["date"]; 

you can refer official documentation here

the supported type date system.datetimeoffset , not system.datetime. so, can modify code this:

applicationdata.current.localsettings.values["date"] = datetimeoffset.utcnow;   

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -