I wrote the following code under the assumption that Excel will die with Monkey:
class ExcelMonkey
{
private static Excel.Application xl = new Excel.Application();
public static bool parse(string filename)
{
if (filename.Contains("foo"))
{
var workbook = xl.Workbooks.Open(filename);
var sheet = workbook.Worksheets.get_Item(1);
// do stuff
return true;
}
return false;
}
}
How do I make sure it does? Do I need to release workbook
and sheet
separately?
I want to have Excel around for the lifetime of the program, it's a huge performance improvement.