public string ParseFirstRowForDelimiters(string path) { using (ITextFieldParser parser = parserFactory.Create(path)) { string line = parser.ReadLine(); return(delimiterLogic.Invoke(line)); } }
private void ReadCsvPath(IList <K> list, IDictionary <K, V> dictionary) { _textFieldParser.CommentTokens = new[] { "#" }; _textFieldParser.SetDelimiters(","); _textFieldParser.HasFieldsEnclosedInQuotes = true; _textFieldParser.ReadLine(); while (!_textFieldParser.EndOfData) { var fields = _textFieldParser.ReadFields(); if (list == null && dictionary != null) { OnReadFields(dictionary, fields); } else if (dictionary == null && list != null) { OnReadFields(list, fields); } } }