My task is simple. I am taking two .csv files, importing them to datatables, comparing each datatable to the other, placing non-matches into new datatables, exporting to a workbook, and notifying email lists of success or failure. I haven't been in C# for a while and am getting back up to speed.

My question deals with the comparing of the datatables. I am building a class to do the compares and figure on passing the import datatables through the constructor. I am struggling with how to handle the export datatables. As I see it, I have three main options and none are elegant:

  • Create the datatable externally and pass as a constructor parameter
  • Create and populate internally and retrieve using a "getter"
  • Create and populate internally and build and populate the workbook from within the class (don't like this one as I will be instantiating the class for each compare)


In addition to being rusty, this is my first full application using C#, so I probably have overlooked other viable options. Please let me know if I did.