/// <summary> /// Initializes a new instance of the CsvRecordReader class. /// </summary> /// <param name="reader">A <see cref="T:TextReader"/> pointing to the CSV file.</param> /// <param name="hasHeaders"><see langword="true"/> if field names are located on the first non commented line, otherwise, <see langword="false"/>.</param> /// <param name="delimiter">The delimiter character separating each field (default is ',').</param> /// <param name="quote">The quotation character wrapping every field (default is ''').</param> /// <param name="escape"> /// The escape character letting insert quotation characters inside a quoted field (default is '\'). /// If no escape character, set to '\0' to gain some performance. /// </param> /// <param name="comment">The comment character indicating that a line is commented out (default is '#').</param> /// <param name="trimmingOptions">Determines which values should be trimmed.</param> /// <param name="bufferSize">The buffer size in bytes.</param> /// <exception cref="T:ArgumentNullException"> /// <paramref name="reader"/> is a <see langword="null"/>. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="bufferSize"/> must be 1 or more. /// </exception> public CsvRecordReader(TextReader reader, bool hasHeaders, char delimiter, char quote, char escape, char comment, ValueTrimmingOptions trimmingOptions, int bufferSize) { this.csvReader = new CsvReader(reader, hasHeaders, delimiter, quote, escape, comment, trimmingOptions, bufferSize); if (hasHeaders) { var headersArray = csvReader.GetFieldHeaders(); this.headers = new CsvHeaders(headersArray); } }
internal CsvRecord(CsvHeaders headers, string[] values) { this.headers = headers; this.fields = values; this._fieldCount = fields.Length; }