Alex
Alex

Reputation: 11137

variable enabled for the entire existence of an app

I am looking for a way to store a variable for the entire existante of the app (the date when the app was last refreshed) , an equivalent of the userDefaults in objective-c iOS.

I was thinking that i could use isolatedStorage, but it doesn't seem to be the best option considering that i am looking to store only one variable (a date string) and creating a file just for that doesn't seem like the shortest way.

Upvotes: 1

Views: 93

Answers (3)

Jared Peless
Jared Peless

Reputation: 1120

Do you need it to persist even when the application is completely shut down? If so, then you will need to use IsolatedStorage. If you only need it while the app is running then a static property of a class that is accessible globally would be fine.

Upvotes: 0

Matt Lacey
Matt Lacey

Reputation: 65564

If you don't have a global view model (or equivalent) you could add a propety to the App class to store this.

Upvotes: 0

Mohamed Abed
Mohamed Abed

Reputation: 5113

you can do this IsolatedStorageSettings.ApplicationSettings

check this post Windows phone 7 config / appSettings?

Upvotes: 3

Related Questions