CsvHelper 28.0.0 changes the ShouldSkipRecordArgs
from a property string[] Record
to IReaderRow Row
. Although this interface exposes a this
property, it does not implement IEnumerable.
Previously you could configure the CsvReader
to skip blank rows by using ShouldSkipRecord = x => x.Record.All(field => string.IsNullOrWhiteSpace(field))
. This is now no longer possible.
What is the recommended approach to skip blank rows as of 28.0.0?
Regards, Rob.
Just found the commit where this change was made, thankfully the unit tests show the update. The string[] Record
property does still exist you just have to navigate to it.
Change:
ShouldSkipRecord = x => x.Record.All(field => string.IsNullOrWhiteSpace(field))
To:
ShouldSkipRecord = x => x.Row.Parser.Record?.All(field => string.IsNullOrWhiteSpace(field)) ?? false