How to update a line in a text file?
<p>I want to update a certain part/line in a text file..</p>

<p>I have this code but it doesn't work:</p>

<pre><code>public static void UpdatingMethod()
{
    string text = File.ReadAllText("fileone.txt");
    text = text.Replace("old value", "new stuff");
    File.WriteAllText("fileone.txt", text);
}

public static void WritingMethod()
{
    int count = 0;
    while (count &lt; 10)
    {
        Console.Write(" Enter your Name: ");
        Name = Console.ReadLine();

        Console.Write(" Enter your ID: ");
        ID = int.Parse(Console.ReadLine());

        Console.Write(" Enter your Age: ");
        Age = int.Parse(Console.ReadLine());

        Console.Write(" Enter your E-mail: ");
        Email = Console.ReadLine();

        StreamWriter Sw = new StreamWriter("fileone.txt", true);
        string output = string.Format("Thank you for registration! Your Submitted information are:" + Environment.NewLine + "Name: {0}"
        + Environment.NewLine + "ID: {1}" + Environment.NewLine + "Age: {2}" + Environment.NewLine + "E-mail: {3}", Name, ID, Age, Email);           
        Console.WriteLine(output);      
        Sw.WriteLine(output + Environment.NewLine);
        Console.ReadLine();

        Sw.Close();
        count++;
    }
}
</code></pre>
