var options = new CsvReaderOptions { Delimiter = "::" };
var options = new CsvReaderOptions { Delimiter = "||" };
var options = new CsvReaderOptions { Delimiter = "\t\t" };// Automatic detection from file extension
using var reader = new CsvDataReader("data.csv.gz");
// Explicit configuration
var options = new CsvReaderOptions
{
CompressionType = CompressionType.GZip,
MaxDecompressedSize = 100 * 1024 * 1024 // 100MB limit
};var options = new CsvReaderOptions
{
EnableParallelProcessing = true,
MaxDegreeOfParallelism = 4,
ParallelBatchSize = 100
};var options = new CsvReaderOptions
{
InternStrings = true,
CustomInternStrings = new HashSet<string> { "Active", "Inactive", "Pending" }
};Inject computed columns into every record:
var options = new CsvReaderOptions
{
StaticColumns = new List<StaticColumn>
{
new StaticColumn("ImportDate", DateTime.Now),
new StaticColumn("SourceFile", "data.csv")
}
};var options = new CsvReaderOptions
{
IncludeColumns = new HashSet<string> { "Id", "Name", "Email" },
// Or exclude specific columns:
ExcludeColumns = new HashSet<string> { "InternalId", "TempField" }
};var options = new CsvReaderOptions
{
SkipRows = 3 // Skip first 3 rows before reading headers
};For malformed CSVs with unmatched quotes or backslash escapes:
var options = new CsvReaderOptions
{
QuoteMode = QuoteMode.Lenient
};// Distinguish between ,, (null) and ,"", (empty string)
var options = new CsvReaderOptions
{
DistinguishEmptyFromNull = true
};