title: F# persist some user values for WPF app
body: <p>In my small WPF app (F# only) I would like to remember the window size and location after closing. <a href="https://stackoverflow.com/questions/847752/net-wpf-remember-window-size-between-sessions">This C# solution</a> suggest to use the projects settings IDictinary for User.config. This looks like the simple approach that I am after but I did not find the project settings in my F# project. Do they exist for F# projects?</p>
  
  <p>I tried this but it does not work: (The save() call as in the C# example is not available.)</p>
  
  <pre><code>let getSetting k def = 
      if Application.Current.Properties.Contains k 
         then Application.Current.Properties.Item k 
         else def
  
  let window = System.Windows.Window()
  // is box() the best wax to make floats into obj ?
  window.Top &lt;-     getSetting "WindowTop"    (box 0.0) |&gt; unbox  
  window.Left &lt;-    getSetting "WindowLeft"   (box 0.0) |&gt; unbox 
  window.Height &lt;-  getSetting "WindowHeight" (box 800.0) |&gt; unbox  
  window.Width &lt;-   getSetting "WindowWidth"  (box 800.0) |&gt; unbox
  
  window.Closing.Add( fun _ -&gt; 
        Application.Current.Properties.Add("WindowTop",window.Top)
        Application.Current.Properties.Add("WindowHeight",window.Height)
        Application.Current.Properties.Add("WindowLeft",window.Left)
        Application.Current.Properties.Add("WindowWidth",window.Width)
        //Application.Current.Properties.Save() // not available!
        )
  </code></pre>
  
  <p>I know I could use a <a href="https://fsprojects.github.io/FSharp.Configuration/AppSettingsProvider.html" rel="nofollow noreferrer">type provider</a> but I would like to keep it simple and without dependencies if possible. Is there a built in way to persist some user values in an F# WPF app?</p>