Click or drag to resize

CsvReader Class

Parses CSV encoded rows from text.
Inheritance Hierarchy
SystemObject
  Neon.CsvCsvReader

Namespace:  Neon.Csv
Assembly:  Neon.Common (in Neon.Common.dll) Version: 2.1.0
Syntax
public sealed class CsvReader : IDisposable

The CsvReader type exposes the following members.

Constructors
  NameDescription
Public methodCsvReader(TextReader)
Constructs a reader to parse text from a TextReader.
Public methodCsvReader(String)
Constructs a reader to parse a string.
Public methodCsvReader(Stream, Encoding)
Constructs a reader to parse a stream.
Top
Methods
  NameDescription
Public methodClose
Closes the reader if it is still open.
Public methodDispose
Releases any resources associated with the reader.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodRead
Parses and returns the next row of fields.
Public methodRows
Returns an enumerator that returns the data rows from a CsvReader.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

Use this class to parse CSV encoded tables. Use one of the constructors to initialize in instance to read from a file, Stream , string, or a TextReader and then call Read to read each row of the table.

This class handles the all special cases for CSV parsing including quoted fields, escaped double quotes, and fields that include CR and LF characters.

Be sure to call Close or Dispose when you are finished with the class to release any underlying resources.

Note Note
The underlying stream must support seeking for this class to work properly.
Thread Safety
Instance members of this type are not safe for multi-threaded operations.
See Also