title: Best way to bind Windows Forms properties to ApplicationSettings in C#?
body: <p>In a desktop application needing some serious re-factoring, I have several chunks of code that look like this:</p>
  
  <pre><code>private void LoadSettings()
  {
      WindowState = Properties.Settings.Default.WindowState;
      Location = Properties.Settings.Default.WindowLocation;
      ...
  }
  
  private void SaveSettings()
  {
      Properties.Settings.Default.WindowState = WindowState;
      Properties.Settings.Default.WindowLocation = Location;
      ...
  }
  </code></pre>
  
  <p>What's the best way to replace this? Project-imposed constraints:</p>
  
  <ul>
  <li>Visual Studio 2005</li>
  <li>C# / .NET 2.0</li>
  <li>Windows Forms</li>
  </ul>
  
  <p><strong>Update</strong></p>
  
  <p>For posterity, I've also found two useful tutorials: <a href="http://www.codeproject.com/KB/cs/UserSettings.aspx" rel="nofollow noreferrer">"Windows Forms User Settings in C#"</a> and <a href="http://www.devx.com/dotnet/Article/33944/0/page/1" rel="nofollow noreferrer">"Exploring Secrets of Persistent Application Settings"</a>.</p>
  
  <p><em>I've asked a follow-up question about using this technique to bind a form's Size <a href="https://stackoverflow.com/questions/18585/why-cant-you-bind-the-size-of-a-windows-form-to-applicationsettings">here</a>. I separated them out to help people who search for similar issues.</em>
  ­­­­­­­­­­­­­­­­­­­</p>