This code snippet demonstrates how to read 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 convert_string_to_binery

{

class Program

{

static void Main(string[] args)

{

TextReader tr = File.OpenText(@"E:\c#\ssdd.txt");

Console.WriteLine(tr.ReadToEnd());

tr.Close();

Console.WriteLine(Console.Read());

}

}

}