C# How to loop through Properties.Settings.Default.Properties changing the values

This might work:

foreach (SettingsProperty  currentProperty in Properties.Settings.Default.Properties)
{
    Properties.Settings.Default[currentProperty.Name] = result.ToString();
    Properties.Settings.Default.Save();
}

Keep in mind that properties should have scope 'User' in order to be saved.


I would agree with your conclusion. What you are going have to do is get the property by the string value.

Properties.Settings.Default[string value] =

    foreach (SettingsProperty currentProperty in Properties.Settings.Default.Properties) 
    {    
    if (Double.TryParse(GenerateValue()), out result))  
       {        

Properties.Settings.Default[ currentProperty.Name ] = result.ToString();
          Properties.Settings.Default.Save(); 
        } 
    } 

The above is what you actually want.