title: how to save listbox item as .config file and read it back to listbox?
body: <p>In my WPF project, I have a listbox that I can add some items to it in this way:</p>
  
  <pre><code>//item is a class type of Product
  var item = GetProductByID(ProductID);
  lb_Configuration.Items.Add(item);
  </code></pre>
  
  <p>Now I want to save the listbox items when I close this application as a config file and when I reopen it, I can reload this config file to application thus to add the corresponding items to the listbox, how should I suppose to do this? Thanks in advance!</p>
  
  <p><strong>Edit</strong>:</p>
  
  <pre><code>    private void OpenFile_Executed(object sender, ExecutedRoutedEventArgs e)
      {
          OpenFileDialog openFile = new OpenFileDialog();
          openFile.Multiselect = true;
          openFile.Title = "Please Choose Your File";
          openFile.Filter = "All Files(*,*)|*.*";
          if (openFile.ShowDialog() == true)
          {
              /* What to do after open file */
              StreamReader sr = File.OpenText(openFile.FileName);
              while (sr.EndOfStream != true) ;
          }
      }
  
      private void SaveFile_Executed(object sender, ExecutedRoutedEventArgs e)
      {
          SaveFileDialog saveFile = new SaveFileDialog();
          saveFile.Filter = "Text File|*.txt";
          if (saveFile.ShowDialog() == true)
          {
              StreamWriter sw = File.AppendText(saveFile.FileName);
              sw.Flush();
              sw.Close();
          }
      }
  </code></pre>