Open and read a file into streams:
using System.IO; StreamReader sr = new StreamReader("test.txt"); string strLine = sr.ReadLine(); while (!sr.EndOfStream) { ... strLine = sr.ReadLine(); } sr.Close();
using System.IO.File; string str = File.ReadAllText("Text.txt");
using System.IO.File; string[] arrlines = File.ReadAllLines("Text.txt"); foreach (string thisline in arrlines) { ... }