billgraziano / CsvDataReader

Fast streaming CSV file reader for PowerShell impleted as a DataReader.
40 stars 22 forks source link

possibility to set different separator and allow headerless csv #10

Open seligam opened 8 years ago

seligam commented 8 years ago

hi

for my experiments I already added it like this (additional constructor)

        public CsvDataReader(string fileName, string separator, string[] columns)
        {
            if (!File.Exists(fileName))
                throw new FileNotFoundException();

            _stream = new StreamReader(fileName);
            _headers = columns;

            if (separator == "|")
                separator = "\\" + separator;

            _CsvRegex = new Regex(separator+"(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))", RegexOptions.Compiled);
        }