C# Class CsvFileReader, chronojump

Class for reading from comma-separated-value (CSV) files
Inheritance: CsvFileCommon, IDisposable
Datei anzeigen Open project: GNOME/chronojump Class Usage Examples

Public Methods

Method Description
CsvFileReader ( Stream stream, EmptyLineBehavior emptyLineBehavior = EmptyLineBehavior.NoColumns ) : System

Initializes a new instance of the CsvFileReader class for the specified stream.

CsvFileReader ( string path, EmptyLineBehavior emptyLineBehavior = EmptyLineBehavior.NoColumns ) : System

Initializes a new instance of the CsvFileReader class for the specified file path.

Dispose ( ) : void
ReadRow ( List columns ) : bool

Reads a row of columns from the current CSV file. Returns false if no more data could be read because the end of the file was reached.

Private Methods

Method Description
ReadQuotedColumn ( ) : string

Reads a quoted column by reading from the current line until a closing quote is found or the end of the file is reached. On return, the current position points to the delimiter or the end of the last line in the file. Note: CurrLine may be set to null on return.

ReadUnquotedColumn ( ) : string

Reads an unquoted column by reading from the current line until a delimiter is found or the end of the line is reached. On return, the current position points to the delimiter or the end of the current line.

Method Details

CsvFileReader() public method

Initializes a new instance of the CsvFileReader class for the specified stream.
public CsvFileReader ( Stream stream, EmptyLineBehavior emptyLineBehavior = EmptyLineBehavior.NoColumns ) : System
stream Stream The stream to read from
emptyLineBehavior EmptyLineBehavior Determines how empty lines are handled
return System

CsvFileReader() public method

Initializes a new instance of the CsvFileReader class for the specified file path.
public CsvFileReader ( string path, EmptyLineBehavior emptyLineBehavior = EmptyLineBehavior.NoColumns ) : System
path string The name of the CSV file to read from
emptyLineBehavior EmptyLineBehavior Determines how empty lines are handled
return System

Dispose() public method

public Dispose ( ) : void
return void

ReadRow() public method

Reads a row of columns from the current CSV file. Returns false if no more data could be read because the end of the file was reached.
public ReadRow ( List columns ) : bool
columns List Collection to hold the columns read
return bool