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
readerTextReaderThe reader.
configurationIParserConfigurationThe configuration.
leaveOpenboolif 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
readerTextReaderThe reader.
cultureCultureInfoThe culture.
leaveOpenboolif set to
true[leave open].
Properties
ByteCount
public long ByteCount { get; }
Property Value
CharCount
public long CharCount { get; }
Property Value
Configuration
public IParserConfiguration Configuration { get; }
Property Value
Context
public CsvContext Context { get; }
Property Value
Count
public int Count { get; }
Property Value
Delimiter
public string Delimiter { get; }
Property Value
this[int]
public string this[int index] { get; }
Parameters
indexint
Property Value
RawRecord
public string RawRecord { get; }
Property Value
RawRow
public int RawRow { get; }
Property Value
Record
public string[]? Record { get; }
Property Value
- string[]
Row
public int Row { get; }
Property Value
Methods
Dispose()
public void Dispose()
Dispose(bool)
Disposes the object.
protected virtual void Dispose(bool disposing)
Parameters
disposingboolIndicates if the object is being disposed.
ProcessEscapeField(int, int)
Processes an escaped field.
protected CsvParser.ProcessedField ProcessEscapeField(int start, int length)
Parameters
Returns
- CsvParser.ProcessedField
The processed field.
ProcessNoEscapeField(int, int)
Processes an non-escaped field.
protected CsvParser.ProcessedField ProcessNoEscapeField(int start, int length)
Parameters
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
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
startintThe start index of the field.
lengthintThe length of the field.
quoteCountintThe number of counted quotes.
Returns
- CsvParser.ProcessedField
The processed field.
Read()
public bool Read()
Returns
ReadAsync()
public Task<bool> ReadAsync()