Guest User

Untitled

a guest
Jan 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. for (int i = 1; i < sheet.RowsCount; i++)
  2. {
  3. var cells = sheet.GetRow(i).Cells;
  4.  
  5. (...)
  6.  
  7. // cells are strings
  8. if (!DateTime.TryParse(cells[1], out DateTime date))
  9. {
  10. Console.WriteLine($"Unable to parse DateTime for row {i}"); // <--- here
  11. continue;
  12. }
  13. }
  14.  
  15. for (int i = 1; i < sheet.RowsCount; i++)
  16. {
  17. var cells = sheet.GetRow(i).Cells;
  18.  
  19. (...)
  20.  
  21. // cells are strings
  22. if (!DateTime.TryParse(cells[1]), out DateTime date))
  23. {
  24. throw new Exception($"Problem with parsing DateTime at {i} row"); // <--- here
  25. }
  26. }
Add Comment
Please, Sign In to add comment