/// <summary> /// 尝试从本地csv文件获取数据,可能会抛出异常 /// </summary> /// <returns></returns> protected List <T> readFromLocalCsv(string path) { DataTable dt = CsvFileUtils.ReadFromCsvFile(path); if (dt == null) { return(null); } //T tmp2 = toEntityFromCsv(dt.Rows[0]); //List<T> tmp= dt.AsEnumerable().Select(toEntityFromCsv).ToList(); return(dt.AsEnumerable().Select(toEntityFromCsv).ToList()); }
//public abstract List<T> readFromLocalCSV(String path); public virtual List <T> readFromLocalCSV(string path) { if (path == null || !File.Exists(path)) { log.Debug("未找到文件{0}!", path); return(null); } DataTable dt = CsvFileUtils.ReadFromCsvFile(path); if (dt == null) { return(null); } return(dt.AsEnumerable().Select(toEntityFromCsv).ToList()); }