Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sealed class MyMapping : CsvClassMap<TradingCalendarException>
- {
- public MyMapping()
- {
- EnumConverter enumConverter = new EnumConverter(typeof(CalendarExceptionEntityType));
- Map(m => m.ExceptionEntityType).Index(0).Name("EXCEPTION_ENTITY_TYPE").TypeConverter(enumConverter);
- Map(m => m.ExceptionEntityIdentifier).Index(1).Name("EXCEPTION_ENTITY_IDENTIFIER");
- Map(m => m.OptionType).Index(2).Name("OPTION_TYPE");
- Map(m => m.StartDatetime).Index(3).Name("EXCEPTION_START_DATETIME");
- Map(m => m.EndDatetime).Index(4).Name("EXCEPTION_END_DATETIME");
- Map(m => m.DataSourceType).Index(5).Name("DATA_SOURCE_TYPE");
- Map(m => m.Description).Index(6).Name("DESCRIPTION");
- }
- }
- using (StreamWriter file = new StreamWriter(filePath, false, Encoding.UTF8))
- {
- CsvWriter writer = new CsvWriter(file);
- MyMapping mapping = new MyMapping();
- writer.Configuration.RegisterClassMap(mapping);
- writer.WriteRecords(calendarExceptionList);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement