public DataTable SplitToTable(string path, CsvSettings csvSettings) { using (var streamReader = new StreamReader(path)) { return SplitToTable(streamReader, csvSettings); } }
public DataTable SplitToTable(string path, CsvSettings csvSettings) { using (var streamReader = new StreamReader(path)) { return(SplitToTable(streamReader, csvSettings)); } }
public DataTable SplitToTable(StreamReader streamReader, CsvSettings csvSettings) { var dataTable = new DataTable(); using (var csvReader = new CsvReader(streamReader, csvSettings.FirstRowIsHeader, csvSettings.Delimiter)) { csvReader.SkipEmptyLines = csvSettings.SkipEmptyLines; try { dataTable.Load(csvReader); } catch { //any error result in an empty data table dataTable = new DataTable(); } } return dataTable; }
public DataTable SplitToTable(StreamReader streamReader, CsvSettings csvSettings) { var dataTable = new DataTable(); using (var csvReader = new CsvReader(streamReader, csvSettings.FirstRowIsHeader, csvSettings.Delimiter)) { csvReader.SkipEmptyLines = csvSettings.SkipEmptyLines; try { dataTable.Load(csvReader); } catch { //any error result in an empty data table dataTable = new DataTable(); } } return(dataTable); }