Click or drag to resize
Accord.NET (logo)

CsvReader Class

Represents a reader that provides fast, non-cached, forward-only access to CSV data.
Inheritance Hierarchy
SystemObject
  Accord.IOCsvReader

Namespace:  Accord.IO
Assembly:  Accord.IO (in Accord.IO.dll) Version: 3.8.0
Syntax
public class CsvReader : IDataReader, IDisposable, 
	IDataRecord, IEnumerable
Request Example View Source

The CsvReader type exposes the following members.

Constructors
  NameDescription
Public methodCsvReader(Stream, Boolean)
Initializes a new instance of the CsvReader class.
Public methodCsvReader(TextReader, Boolean)
Initializes a new instance of the CsvReader class.
Public methodCsvReader(String, Boolean)
Initializes a new instance of the CsvReader class.
Public methodCsvReader(TextReader, Boolean, Char)
Initializes a new instance of the CsvReader class.
Public methodCsvReader(TextReader, Boolean, Int32)
Initializes a new instance of the CsvReader class.
Public methodCsvReader(TextReader, Boolean, Char, Int32)
Initializes a new instance of the CsvReader class.
Top
Properties
  NameDescription
Public propertyBufferSize
Gets the buffer size.
Public propertyComment
Gets the comment character indicating that a line is commented out. Default is '#'.
Public propertyCurrentRecordIndex
Gets the current record index in the CSV file.
Public propertyDefaultHeaderName
Gets or sets the default header name when it is an empty string or only whitespaces. The header index will be appended to the specified name. Default is "Column".
Public propertyDefaultParseErrorAction
Gets or sets the default action to take when a parsing error has occured.
Public propertyDelimiter
Gets the delimiter character separating each field. If set to zero ('\0') the reader will try to guess the delimiter character automatically from the first line of the file.
Public propertyEndOfStream
Gets a value that indicates whether the current stream position is at the end of the stream.
Public propertyEscape
Gets the escape character letting insert quotation characters inside a quoted field. Default is '"'.
Public propertyFieldCount
Gets the maximum number of fields to retrieve for each record.
Public propertyHasHeaders
Indicates if field names are located on the first non commented line.
Public propertyIsDisposed
Gets a value indicating whether the instance has been disposed of.
Public propertyItemInt32
Gets the field at the specified index.
Public propertyItemString
Gets the field with the specified name. [M:hasHeaders] must be .
Public propertyItemInt32, Int32
Gets the field at the specified index and record position.
Public propertyItemInt32, String
Gets the field with the specified name and record position. [M:hasHeaders] must be .
Public propertyMissingFieldAction
Gets or sets the action to take when a field is missing.
Public propertyMissingFieldFlag
Indicates if one or more field are missing for the current record. Resets after each successful record read.
Public propertyParseErrorFlag
Indicates if a parse error occurred for the current record. Resets after each successful record read.
Public propertyQuote
Gets the quotation character wrapping every field. Default is '"'.
Public propertySkipEmptyLines
Gets or sets a value indicating if the reader will skip empty lines.
Public propertySupportsMultiline
Gets or sets a value indicating if the reader supports multiline fields.
Public propertyTrimmingOption
Indicates if spaces at the start and end of a field are trimmed. Default is to trim unquoted fields only.
Top
Methods
  NameDescription
Protected methodCheckDisposed
Checks if the instance has been disposed of, and if it has, throws an ObjectDisposedException; otherwise, does nothing.
Public methodClose
Closes the IDataReader Object.
Public methodCopyCurrentRecordTo(String)
Copies the field array of the current record to a one-dimensional array, starting at the beginning of the target array.
Public methodCopyCurrentRecordTo(String, Int32)
Copies the field array of the current record to a one-dimensional array, starting at the beginning of the target array.
Public methodDispose
Releases all resources used by the instance.
Protected methodDispose(Boolean)
Releases the unmanaged resources used by this instance and optionally releases the managed resources.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Releases unmanaged resources and performs other cleanup operations before the instance is reclaimed by garbage collection.
(Overrides ObjectFinalize.)
Public methodStatic memberFromText
Creates a new CsvReader to read from a string.
Public methodStatic memberFromUrl
Creates a new CsvReader to read from a Web URL.
Public methodGetEnumerator
Returns an RecordEnumerator that can iterate through CSV records.
Public methodGetFieldHeaders
Gets the field headers.
Public methodGetFieldIndex
Gets the field index for the provided header.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMoveTo
Moves to the specified record index.
Protected methodOnDisposed
Raises the [M:Disposed] event.
Protected methodOnParseError
Raises the [M:ParseError] event.
Public methodReadLine
Reads the entire stream into a list of records.
Public methodReadNextRecord
Reads the next record.
Protected methodReadNextRecord(Boolean, Boolean)
Reads the next record.
Public methodReadToEnd
Reads the entire stream into a list of records.
Public methodToJagged
Reads the entire stream into a jagged matrix.
Public methodToJaggedT
Reads the entire stream into a jagged matrix.
Public methodToMatrix
Reads the entire stream into a multi-dimensional matrix.
Public methodToMatrixT
Reads the entire stream into a multi-dimensional matrix.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodToTable
Reads the entire stream into a DataTable.
Public methodToTable(String)
Reads the entire stream into a DataTable.
Top
Events
  NameDescription
Public eventDisposed
Occurs when the instance is disposed of.
Public eventParseError
Occurs when there is an error while parsing the CSV stream.
Top
Fields
  NameDescription
Public fieldStatic memberDefaultBufferSize
Defines the default buffer size.
Public fieldStatic memberDefaultComment
Defines the default comment character indicating that a line is commented out.
Public fieldStatic memberDefaultDelimiter
Defines the default delimiter character separating each field.
Public fieldStatic memberDefaultEscape
Defines the default escape character letting insert quotation characters inside a quoted field.
Public fieldStatic memberDefaultQuote
Defines the default quote character wrapping every field.
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodSetEqualsString
Compares two enumerables for set equality. Two enumerables are set equal if they contain the same elements, but not necessarily in the same order.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
See Also