IsolatedStorageSetting on Windows Forms?

1

I'm used to using for Windows Phone, like this:

using System.IO.IsolatedStorage;
public void putString(string key, string variable)
{
    IsolatedStorageSettings iso = IsolatedStorageSettings.ApplicationSettings;
    if (iso.Contains(key)) //Apenas atualiza os valores das chaves
    {
        iso[key] = variable;
    }
    else //Cria novas chaves
    {
        iso.Add(key, variable);
    }
    iso.Save(); 
}

public void getString(TextBox text, string save)
{
    IsolatedStorageSettings iso = IsolatedStorageSettings.ApplicationSettings;
    if (iso.TryGetValue<string>(text.Name, out save))
        text.Text = save;
}

To write a value and get the value, respectively, but in Windows Forms there is IsolatedStorageSettings which is the easiest method to write data in Windows Forms? It can be just String itself, all I found was via file manipulation, which is more complicated.

Is there a method similar to the one I put up? Used to record a kind of dictionary, with key and value, as it would be faster and at lower cost.

    
asked by anonymous 19.09.2015 / 21:32

1 answer

2

It's in the same file. You have the possibility to use the Windows registry but I do not advise.

What you can do to make it easier is to use something ready. I do not like these solutions ready but I know it meets what most need. One such solution is to use ApplicationSettings . (has an example using).

Teaching how-to tutorial .

More detailed information .

The ConfigurationMamager class also may be an option. It is less flexible but can solve what you need.

All namespace System.Configuration is dedicated to this.

There are third-party libraries but you should only go after them if they do not.

    
19.09.2015 / 21:57