[]
Gets or sets a custom parser used when opening CSV content.
The parser is called for each parsed CSV cell and can inspect the original text or modify the imported value and number format.
public ICsvParser Parser { get; set; }
Public Property Parser As ICsvParser
class LeadingZeroParser : ICsvParser
{
public void Parse(CsvParseResult result, CsvParseContext context)
{
if (context.Text.StartsWith("00"))
{
result.Value = context.Text;
}
}
}
CsvOpenOptions options = new CsvOpenOptions();
options.Parser = new LeadingZeroParser();
ICsvParser customParser = options.Parser;