Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Custom Configurations

JoshClose edited this page · 4 revisions

Custom Configurations Examples

Custom Delimiter

Let's say you want to use a ; instead of a comma:

FileStream f = new FileStream(filePath, FileMode.Open);
StreamReader streamReader = new StreamReader(f);
/* A new configuration instance that you can change at will */
CsvConfiguration config = new CsvConfiguration(); 
config.Delimiter = ';';
/* Give it to your CsvReader */
CsvReader csvReader = new CsvReader(streamReader, config);

Configuration Options

  • QuoteAllFields - {boolean} - Set if all fields get wrapped in quotes or just the mandatory ones.
  • QuoteNoFields - {boolean} - Set to enforce no fields get quoted.
  • HasHeaderRecord - {boolean} - CSV file shall have a header record, default is true
  • IsStrictMode - {boolean} - Enable strict reading, if an error occurs will throw exception.
  • Delimiter - {string} - Set a field delimiter, default is ","
  • Quote - {string} - Character to use for quoted fields, default is '"'
  • AllowComments - {boolean} - Allow comment out lines
  • BufferSize - {int} - Size of buffer for reading/writing csv, default is 2048
Something went wrong with that request. Please try again.