예제 #1
0
        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;
            }));
        }
예제 #2
0
        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;
            }));
        }
예제 #3
0
 public static IEnumerable <T> ReadCsv2 <T>(string path) where T : new()
 {
     return(CsvReader.ReadCsv(path, GetObject <T>));
 }
예제 #4
0
 public static IEnumerable <string[]> ReadCsv1(string path)
 {
     return(CsvReader.ReadCsv(path, (header, values) => values.Select(x => x == "NA" ? null : x).ToArray()));
 }