/// <summary> /// 将csv文本文件解析为一个数据表 /// </summary> /// <param name="csvFile"></param> /// <param name="charset"></param> /// <returns></returns> public static DataTable ReadAll(string csvFile, Encoding charset) { using (CSVTextReader reader = new CSVTextReader(csvFile, charset)) { return(reader.ReadAll()); } }
/// <summary> /// 将csv文本解析为一个数据表 /// </summary> /// <param name="csvText"></param> /// <returns></returns> public static DataTable ReadAll(string csvText) { using (CSVTextReader reader = new CSVTextReader(csvText)) { return(reader.ReadAll()); } }