title: Editing some text in a text file in WPF
body: <p>I am new to using forms and C # and trying to do an assignment to create a phone book. I have different options in my phone book</p>
  
  <ul>
  <li>To Add a contact</li>
  <li>To show all contacts </li>
  <li>and To edit a certain contact.</li>
  </ul>
  
  <p>I am having trouble in how to do editing when text is stored in a text file. I have the following code for my add which adds name, phone number and email. How would i be able to edit one of the names from a list of contacts that is saved in the text file?</p>
  
  <p>Add Code:</p>
  
  <pre><code>private void addButton_Click(object sender, RoutedEventArgs e)
  {
      TextWriter writer = new StreamWriter("D:\\class1.txt", append: true);
      try
      {
              string Name01 = firstName.Text;
              string Name02 = lastName.Text;
              string Phone1 = mobile.Text; 
              string Phone2 = homePhone.Text;
              string emailadd = email.Text;
              string Informtion = Name01 + "\n" + Name02 + "\n" + Phone1 + "\n" + Phone2 + "\n" + emailadd;
              writer.WriteLine("---------------");
              writer.WriteLine(Informtion);
              MessageBox.Show("Success!! Contact information added for: " +Name01 + " " +Name02);
          }
          catch (Exception ex)
          {
              throw ex;
          }  
          finally
          {
              writer.Close();
              writer.Dispose();
          }
      }
  </code></pre>