Pregunta

I am looking at way to store data in Win Phone 8 using C#.

Firstly, is it possible to create more than one instance of IsolatedStorageSettings?

For example would the code below amount to two separate sets of settings:

IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
IsolatedStorageSettings settings2 = IsolatedStorageSettings.ApplicationSettings;

Secondly I looked into IsolatedStorageFiles but got an error on the code below. May be the example I'm using has skipped some steps.

IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);

Errors:

  • 'System.IO.IsolatedStorage.IsolatedStorageFile' does not contain a definition for 'GetStore'
  • The name 'IsolatedStorageScope' does not exist in the current context
  • The name 'IsolatedStorageScope' does not exist in the current context
¿Fue útil?

Solución

Check out this article on MSDN IsolatedStorageSettings.ApplicationSettings Property as it clearly state

Gets an instance of IsolatedStorageSettings that contains the contents of the application's IsolatedStorageFile, scoped at the application level, or creates a new instance of IsolatedStorageSettings if one does not exist.

so it is not possible to create more then one instances of IsolatedStorageSettings.

For IsolatedStorageFiles, There is a pretty comprehensive example at the msdn page for dealing with it. IsolatedStorageFile Class

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top