Using StreamReader
First you can use StreamReader you must using namespace IO like this code.
using System.IO;
after you use IO namespace when new StreamReader object you must declare in try{}catch(Exception ex){} like this.
try
{
StreamReader sr = new StreamReader(@"C:\Users\AWAT\Documents\Rule.txt");
string line;
while ((line = sr.ReadLine()) != null)
{
//Some code
}
}
catch(Exception ex)
{
MessageBox.show (ex.message);
}