Reading a Flat File without loading the result list into memory.

Ndebata
Posted by Ndebata under C# category on | Points: 40 | Views : 2637
private static IEnumerable<string[]> GetLineText(string FilePath)
{
using (StreamReader rdr = new StreamReader(FilePath))
{
string line;
while ((line = rdr.ReadLine()) != null)
{
// in this case data in flat file are separated by pipe("|").
yield return line.Split('|');
}
}
}


Thanks,
Debata

Comments or Responses

Login to post response