Writing into a file in C#

You can generate a file and write content to it easily by this code.

using --> It will automatically dispose/release the resources once the operation done.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            // Choose a path for saving a file
            string path = "D:\\tmp.txt";

            // Enter value for writing into a file
            string input = Console.ReadLine().ToString();

            using (StreamWriter streamWriter = new StreamWriter(path))
            {
                streamWriter.Write(input);
            }
                                      
           
        }
    }
}


..