Viewing and updating file content in C#

We can view the content of a file and update it with new content.

using System;
using System.IO;

namespace forgetCode
    class Program
        static void Main(string[] args)
            string path = "D:\\test.txt";
            if (File.Exists(path))
                string content = File.ReadAllText(path);
                Console.WriteLine("Current content of file:");

            Console.WriteLine("\nPlease enter the new content");
            string newContent = Console.ReadLine();

            File.WriteAllText(path, newContent);


The content of file will be shown.
The user can enter new content and it will be written to the same file.