예제 #1
0
        public List <dynamic> ReadAsDynamic(string file)
        {
            var parser = new ExcelDataReaderToIParser(file, new ExcelDataOptions());

            using (var csv = new CsvReader(parser))
            {
                return(csv.GetRecords <dynamic>().ToList());
            }
        }
예제 #2
0
        public List <T> ReadWithClass <T, T2>(string file) where T2 : ClassMap <T>
        {
            var parser = new ExcelDataReaderToIParser(file, new ExcelDataOptions());

            using (var csv = new CsvReader(parser))
            {
                csv.Configuration.RegisterClassMap <T2>();

                return(csv.GetRecords <T>().ToList());
            }
        }
예제 #3
0
        public List <dynamic> ReadAsExpandoObject(string file, ExpandoObject expando)
        {
            var parser = new ExcelDataReaderToIParser(file, new ExcelDataOptions());

            using (var csv = new CsvReader(parser))
            {
                foreach (var property in expando)
                {
                    Console.WriteLine(property.Key + ": " + property.Value);
                }

                return(csv.GetRecords <dynamic>(expando).ToList());
            }
        }