If you are planning to convert the file into DataTable, there is a better option
Please use CsvEngine of FileHelpers library. See the code snippet below:
using (MemoryStream stream = new MemoryStream(_fileContent)) //file content can be file as byte array
{
TextReader reader = new StreamReader(stream);
string path = "C:\\Sample.csv";
CsvEngine csvEngine = new CsvEngine("Model", ',', path);
var dataTable = csvEngine.ReadStreamAsDT(reader);
//Do whatever with dataTable
}
Here the sample file can be csv file or text file contains the header of the csv file you want to process. The columns of the DataTable will be named according to the header of the sample file
Cheers