Click or drag to resize

IFileHelperAsyncEngineTReadNext Method

Reads the next record of a file.

Namespace:  FileHelpers
Assembly:  FileHelpers (in FileHelpers.dll) Version: 3.2.6
Syntax
T ReadNext()

Return Value

Type: T
The current record of the opened file.
Remarks

This method returns the current record and moves to the next.

If the end of file is reached this method return null.

Examples
This example shows a simple example of use of the async methods in the FileHelperAsymcEngine:
using FileHelpers;

// First declare the record class

[Delimitedrecord("|")]
public class SampleType
{
    public string Field1;
    public int    Field2;
}


public void ReadExample()
{
    SampleType record;    

    var engine = new FileHelperAsyncEngine<SampleType>();

    using(engine.BeginReadFile("source.txt"))
    {
        foreach(var record in engine)
        {

           // put your code here !!!!
           Console.WriteLine("Data " + record.Field1 + " , " + record.Field2.ToString());

        }
    }
}
See Also