Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions code/LumenWorks.Framework.IO/Csv/CsvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,9 +1418,12 @@ public bool ReadNextRecord()
/// Indicates if the reader will skip directly to the next line without parsing the current one.
/// To be used when an error occurs.
/// </param>
/// <param name="caseSensitiveHeaders">
/// Indicates if the reader should be case-sensitive when parsing headers.
/// </param>
/// <returns><see langword="true"/> if a record has been successfully reads; otherwise, <see langword="false"/>.</returns>
/// <exception cref="T:System.ComponentModel.ObjectDisposedException">The instance has been disposed of.</exception>
protected virtual bool ReadNextRecord(bool onlyReadHeaders, bool skipToNextLine)
protected virtual bool ReadNextRecord(bool onlyReadHeaders, bool skipToNextLine, bool caseSensitiveHeaders = false)
{
if (_eof)
{
Expand Down Expand Up @@ -1488,7 +1491,8 @@ protected virtual bool ReadNextRecord(bool onlyReadHeaders, bool skipToNextLine)
Array.Resize(ref _fields, _fieldCount);
}

_fieldHeaderIndexes = new Dictionary<string, int>(_fieldCount, StringComparer.CurrentCultureIgnoreCase);
var headerComparer = caseSensitiveHeaders ? StringComparer.CurrentCulture : StringComparer.CurrentCultureIgnoreCase;
_fieldHeaderIndexes = new Dictionary<string, int>(_fieldCount, headerComparer);

_initialized = true;

Expand Down