C# Class Mono.Csv.CsvFileReader

Class for reading from comma-separated-value (CSV) files
Inheritance: CsvFileCommon, IDisposable
Afficher le fichier Open project: floatinghotpot/LiteCsvParser Class Usage Examples

Méthodes publiques

Méthode Description
CsvFileReader ( Stream stream, EmptyLineBehavior emptyLineBehavior = EmptyLineBehavior.NoColumns ) : System

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

CsvFileReader ( StreamReader reader, 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
ReadAll ( string path, Encoding encoding ) : List>
ReadAll ( List dataGrid ) : bool
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

Méthode 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 méthode

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
Résultat System

CsvFileReader() public méthode

Initializes a new instance of the CsvFileReader class for the specified stream.
public CsvFileReader ( StreamReader reader, EmptyLineBehavior emptyLineBehavior = EmptyLineBehavior.NoColumns ) : System
reader System.IO.StreamReader
emptyLineBehavior EmptyLineBehavior Determines how empty lines are handled
Résultat System

CsvFileReader() public méthode

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
Résultat System

Dispose() public méthode

public Dispose ( ) : void
Résultat void

ReadAll() public static méthode

public static ReadAll ( string path, Encoding encoding ) : List>
path string
encoding System.Text.Encoding
Résultat List>

ReadAll() public méthode

public ReadAll ( List dataGrid ) : bool
dataGrid List
Résultat bool

ReadRow() public méthode

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
Résultat bool