title: saving xml file using save file dialog
body: <p>I  tried to open an xml file with open file dialog and want to  removed some duplicate data from the file now my problem is selecting the file and saving that file (load, delete,save buttton on my winforms).can you please where am I going wrong.</p>
  
  <pre><code>public Form1()
  {
       InitializeComponent();
  }
  
  private void button1_Click(object sender, EventArgs e) // open file dialog works fine
  {
       OpenFileDialog openFileDialog1 = new OpenFileDialog();
  
       openFileDialog1.Filter = "XML files(.xml)|*.xml|all Files(*.*)|*.*";
       openFileDialog1.FilterIndex = 1;
  
       openFileDialog1.Multiselect = true;
  
       if (openFileDialog1.ShowDialog() == DialogResult.OK)
       {
          {
  
          }
  
  
       }
  }
  
  private void button2_Click(object sender, EventArgs e)//Deleteing  duplicate data
  {
       //var doc = XDocument.Load(@"C:\\Users\IT-Administrator\Desktop\21.xml");/ do i need to use this line.
       doc.Root.Elements("Incident")
       .GroupBy(s =&gt; (string)s.Element("Comment"))
       .SelectMany(g =&gt; g.Skip(1))
       .Remove();
  
  
        //doc.Save(@"C:\Users\IT-Administrator\Desktop\2014-01-07_Middlesex.xml");
  
        //doc.Save(@"C:\Users\IT-Administrator\Desktop\22.xml");
  }
  
  
  
  private void button3_Click(object sender, EventArgs e)//saving..
  {
     //doc.Save(@"C:\Users\IT-Administrator\Desktop\22.xml");
     saveFileDialog1.ShowDialog();
  
  }
  </code></pre>