What's the best way to read a tab-delimited text file in C#

ado.net, c#, datatable, etl

Solution

I would read it in as a CSV with the tab column delimiters:

A Fast CSV Reader

Edit: Here's a barebones example of what you'd need:

DataTable dt = new DataTable();
using (CsvReader csv = new CsvReader(new StreamReader(CSV_FULLNAME), false, '\t')) {
    dt.Load(csv);
}

Where CSV_FULLNAME is the full path + filename of your tab delimited CSV.

Problem

We have a text file with about 100,000 rows, about 50 columns per row, most of the data is pretty small (5 to 10 characters or numbers). This is a pretty simple task, but just wondering what the best way would be to import this data into a C# data structure (for example a DataTable)?

Original source