public void read(int lineNumber)
{
int counter = 0;
string line;
System.IO.StreamReader file =new System.IO.StreamReader("D:\\test1.txt");
string newstr = null;
while ((line = file.ReadLine()) != null)
{
if ((counter + 1).Equals(lineNumber))
{
}
else
{
newstr += line + Environment.NewLine;
}
counter++;
}
file.Close();
if (System.IO.File.Exists("D:\\test1.txt"))
{
System.IO.StreamWriter sw = new System.IO.StreamWriter("D:\\test1.txt");
sw.WriteLine(newstr);
sw.Close();
}
}
call the read method and pass the line number