Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- CsvParserOptions csvParserOptions = new CsvParserOptions(true, new[] { ';' });
- CsvReaderOptions csvReaderOptions = new CsvReaderOptions(new[] { Environment.NewLine });
- CsvMapping csvMapper = new CsvMapping();
- CsvParser<Person> csvParser = new CsvParser<Person>(csvParserOptions, csvMapper);
- var result = csvParser
- .ReadFromFile(@"D:\Workspace_DotNet\TinyCsvAMP\TinyCsvAMP\ANET_20160212_0101613BA01_001.csv", Encoding.ASCII)
- .ToList();
- }
- }
- public class Person
- {
- public string name { get; set; }
- public string Address { get; set; }
- public ContactDetails contactDetails { get; set; }
- }
- public class ContactDetails
- {
- public string emailAddress { get; set; }
- }
- public class Company
- {
- public string name { get; set; }
- public string Address { get; set; }
- }
- public class CsvMapping : CsvMapping<Person>
- {
- public CsvMapping()
- : base()
- {
- MapProperty(0, x => x.name);
- MapProperty(1, x => x.Address);
- }
- }
Add Comment
Please, Sign In to add comment