Do I need to call the IsolStorageSettings.Save method in an application for a Windows phone?

From the comments section of the Isolated page Save. Save method :

The data written to the IsolatedStorageSettings object is saved when the application using the class is closed. This can happen when a user closes a web browser, refreshes a page or views a page. If you want your application to be written to isolated storage immediately, you can call the Save method in the application code.

So, I can never name the Save method, and all settings will be safe. I'm just wondering when should I use the Save method?

+4
source share
2 answers

You need to call IsolatedStorageSettings.Save yourself. As mentioned in the “Tips and Warnings” section at the bottom of the class’s man page , you must save it yourself to make sure it is written to a file.

The IsolatedStorageSettings class is not automatically saved to disk when values ​​are written. Saving is done in the finalizer, which is usually, but not always, done when the application shuts down. To ensure savings, in fact, we must call the Save method after each record or set of writes.

+8
source

Here is the documentation for the IsolStorageSettings.Save method dated February 14, 2014:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.io.isolatedstorage.isolatedstoragesettings.save(v=vs.105).aspx

And an excerpt from it (see Warning):

However, you do not need to call the Save method on Windows Phone. Data stored in an IsolatedStorageSettings object is saved automatically.

My experience as a developer also proves that - settings are saved automatically without the need to directly call the Save method. But note that this only happens when you close the entire application, as indicated on MSDN:

The data written to the IsolatedStorageSettings object is saved when the application using the class is closed. If you want the application to write immediately to isolated storage Save the method in the application code.

+1
source

Source: https://habr.com/ru/post/1444132/


All Articles