Hi
I have written a wrapper that encapsulates the Excel object model. As anyone
who's done a similar thing knows, its important to release the objects when
the app exits otherwise they still remain as a running process within
windows.
I've done this and so long as the code is called, it works well.
I then implemented Idisposable, and in my class put the clean up code in the
Dispose method.
Again this works OK so long as I call the dispose method when I'm done.
What I wanted, and what I thought would happen is that when the object went
out scope, it would be disposed of.
i.e.
private void button1_Click(object sender, EventArgs e)
{
ExcelWrapper TestSheet = new ExcelWrapper(@"C:\Test.XLS");
....
....
}
Dispose called here???
I thought the dispose method would have been called automatically as it
exited the function.
So what I'm getting at is, is there any way of ensuring that objects are
cleared automatically when they leave scope, or is it the programmers
responsibility.
thanks in advance
Andy