Guest User

Untitled

a guest
May 21st, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. ID,Type,Name,Description,Image
  2. 11,Variation,MyCoolProduct,A super cool product, Image1 | Image2
  3.  
  4. var records = new List<Columns>
  5. {
  6. new Columns {ID = 12, Type = "Variation", Description = "Simple product with different colors",
  7. Images = "Image1 | Image 2", Price = 19.99d}
  8. };
  9.  
  10. using (StreamWriter sw = new StreamWriter("Testfile.csv"))
  11. {
  12. var writer = new CsvWriter(sw);
  13. writer.WriteRecords(records);
  14. }
  15.  
  16. public class ColMap : CsvClassMap<Column>
  17. {
  18. public ColMap()
  19. {
  20. Map(m=>m.ID).Name("ID").Index(0);
  21. .
  22. .
  23. .
  24. }
  25. }
Add Comment
Please, Sign In to add comment