Чтобы прочитать файл построчно, попробуйте следующее:
using (var reader = new StreamReader(path))
{
string line;
while ((line = reader.ReadLine()) != null)
{
// do something with the line that was just read from the file
}
}
// At this stage you can safely delete the file
File.Delete(path);
или, если файл небольшой, вы можете даже загрузить все строки в памяти:
string[] lines = File.ReadAllLines(path);
// Do something with the lines that were read
...
// At this stage you can safely delete the file
File.Delete(path);