public static IEnumerable <Dictionary <string, object> > ReadCsv3(string path) { return(CsvReader.ReadCsv(path, (header, values) => { var result = new Dictionary <string, object>(); for (var i = 0; i < values.Length; i++) { result.Add(header[i], Converter.Convert(header[i], values[i])); } return result; })); }
public static IEnumerable <dynamic> ReadCsv4(string path) { return(CsvReader.ReadCsv(path, (header, values) => { var result = new ExpandoObject(); var expandoDict = (IDictionary <string, object>)result; for (var i = 0; i < values.Length; i++) { expandoDict.Add(header[i], Converter.DynamicConvert(values[i])); } return result; })); }
public static IEnumerable <T> ReadCsv2 <T>(string path) where T : new() { return(CsvReader.ReadCsv(path, GetObject <T>)); }
public static IEnumerable <string[]> ReadCsv1(string path) { return(CsvReader.ReadCsv(path, (header, values) => values.Select(x => x == "NA" ? null : x).ToArray())); }