Table of Contents

Class CsvParser

Namespace
CsvHelper
Assembly
CsvHelper.dll

Parses a CSV file.

public class CsvParser : IParser, IDisposable
Inheritance
CsvParser
Implements
Inherited Members

Constructors

CsvParser(TextReader, IParserConfiguration, bool)

Initializes a new instance of the CsvParser class.

public CsvParser(TextReader reader, IParserConfiguration configuration, bool leaveOpen = false)

Parameters

reader TextReader

The reader.

configuration IParserConfiguration

The configuration.

leaveOpen bool

if set to true [leave open].

CsvParser(TextReader, CultureInfo, bool)

Initializes a new instance of the CsvParser class.

public CsvParser(TextReader reader, CultureInfo culture, bool leaveOpen = false)

Parameters

reader TextReader

The reader.

culture CultureInfo

The culture.

leaveOpen bool

if set to true [leave open].

Properties

ByteCount

public long ByteCount { get; }

Property Value

long

CharCount

public long CharCount { get; }

Property Value

long

Configuration

public IParserConfiguration Configuration { get; }

Property Value

IParserConfiguration

Context

public CsvContext Context { get; }

Property Value

CsvContext

Count

public int Count { get; }

Property Value

int

Delimiter

public string Delimiter { get; }

Property Value

string

this[int]

public string this[int index] { get; }

Parameters

index int

Property Value

string

RawRecord

public string RawRecord { get; }

Property Value

string

RawRow

public int RawRow { get; }

Property Value

int

Record

public string[]? Record { get; }

Property Value

string[]

Row

public int Row { get; }

Property Value

int

Methods

Dispose()

public void Dispose()

Dispose(bool)

Disposes the object.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Indicates if the object is being disposed.

ProcessEscapeField(int, int)

Processes an escaped field.

protected CsvParser.ProcessedField ProcessEscapeField(int start, int length)

Parameters

start int

The start index of the field.

length int

The length of the field.

Returns

CsvParser.ProcessedField

The processed field.

ProcessNoEscapeField(int, int)

Processes an non-escaped field.

protected CsvParser.ProcessedField ProcessNoEscapeField(int start, int length)

Parameters

start int

The start index of the field.

length int

The length of the field.

Returns

CsvParser.ProcessedField

The processed field.

ProcessRFC4180BadField(int, int)

Processes a field that does not comply with RFC4180.

protected CsvParser.ProcessedField ProcessRFC4180BadField(int start, int length)

Parameters

start int

The start index of the field.

length int

The length of the field.

Returns

CsvParser.ProcessedField

The processed field.

ProcessRFC4180Field(int, int, int)

Processes a field that complies with RFC4180.

protected CsvParser.ProcessedField ProcessRFC4180Field(int start, int length, int quoteCount)

Parameters

start int

The start index of the field.

length int

The length of the field.

quoteCount int

The number of counted quotes.

Returns

CsvParser.ProcessedField

The processed field.

Read()

public bool Read()

Returns

bool

ReadAsync()

public Task<bool> ReadAsync()

Returns

Task<bool>