I am wondering while it is reading in a stream from a file can you tell it to only take x amount of rows? Say if you want 100 rows from the file can you tell it to only take the first 100 rows(ignoring the first row as it would be the header). Even if the file had 200 rows?
You can use the FileHelperAsyncEngine which processes the records one by one.
FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof(Customer));
engine.BeginReadFile("TestIn.txt");
int recordCount = 0;
foreach (Customer cust in engine)
{
// your code here
Console.WriteLine(cust.Name);
recordCount++;
if (recordCount > 100)
break; // stop processing
}
engine.Close();