This code snippet demonstrates how to write a text file and write text on a console.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace how_to_write_text
{
class Program
{
static void Main(string[] args)
{
TextWriter tw = File.CreateText(@"E:\output.txt");
tw.WriteLine("owais khan sherwani");
Console.WriteLine("Text created");
tw.Close();
Console.WriteLine(Console.Read());
}
}
}