Well, it depends.
First, I'm not sure what you're talking about WPF or Windows Forms, so I will not do this.
Secondly, you are not โtyingโ anything. You take the Name value and set the Text property to this value. You set the property. This is not due to magical side effects that inextricably bind the Name property to the Text property.
Thirdly, you can change the settings, but until you save them, they will not be returned to your app.config. In a Windows Forms application, you will need to do something like this:
// event handler for the Form.Closed event. // this.FormClosed += FormClosed; void FormClosed(object sender, FormClosedEventArgs e) { Settings.Default.Name = textBox.Text; Settings.Default.Save(); }
In WPF, you should use the standard binding semantics (this means that you avoid the hassle of setting all property values โโwhen closing), but you still have a trap to close the form so that you can save () the settings.
Binding:
<TextBox xmlns:lol="clr-namespace:MyApplication.Settings" Text="{Binding Name, Source={x:Static lol:Default}}" />
The call to Save () is the same as in the example with Forms, but you do not need to do anything except call Save ().
Will
source share