Romasz
Romasz

Reputation: 29792

How does LocalSettings work?

i'm struggling myself with a question - how does in fact LocalSettings work. It's an ApplicationDataContainer class, but is this some kind of a file? Probably yes, but when it's saved?

For example we can save some data like this:

localSettings.Values["exampleSetting"] = "Hello Windows";

but is it saved to file just after we add/change the Value or it's held somewhere in the memory and saved when App is being Suspended/Terminated?

And the main purpose of the question:

Upvotes: 0

Views: 183

Answers (1)

Sean McKenna
Sean McKenna

Reputation: 3714

LocalSettings (and RoamingSettings) provide an access model that is conceptually equivalent to the Windows registry. Write operations are synchronous, atomic, and implement last writer wins semantics. Any changes made to settings are immediately available to other threads.

Note: If you need to create an atomic setting that contains multiple key/value pairs, you should use the ApplicationDataCompositeValue class.

Upvotes: 3

Related Questions