title: C#- How to use OpenFileDialog to load a ConfigurationUserLevel file?
body: <p>I want to be able to load a config file (.config) of type System.Configuration.ConfigurationUserLevel using OpenFileDialog. </p>
  
  <p>I need the file to be a ConfigurationUserLevel because the I need to use .AppSettings, as its functionality already exists in many other places throughout my code.</p>
  
  <p>Currently I have,</p>
  
  <pre><code>if (openFileDialog1.ShowDialog() == DialogResult.OK)
  {
      var extension = Path.GetExtension(openFileDialog1.FileName);
      if(extension.Equals(".config"))
      {
          try
          {
              var configFile = (ConfigurationUserLevel)openFileDialog1.OpenFile();
              var settings = configFile.AppSettings.Settings;
  </code></pre>
  
  <p>but I get an error saying that I cannot simply convert from a Stream to ConfigurationUserLevel.</p>
  
  <p>Is there a way for me to get a ConfigurationUserLevel file from an openFileDialog? Or is there a workaround? </p>