- RunMeFirst , RunMeSecond ?
, xlsWb :
public void RunMeFirst()
{
System.Type oSEType = Type.GetTypeFromProgID("Excel.Application");
xlsApp = Activator.CreateInstance(oSEType);
Workbook xlsWb = xlsApp.Workbooks.Open("C:\\test1.xls");
xlsWb.Close(false);
System.Environment.Exit(0);
}
- ReleaseComObject, (, , COM- , ). COM , , COM , GC ( , , 100%).
, xlsWb ( ) , , , . COM, , - null, COM- GC:
xlsWb = null;
GC.Collect - , GC.Collect ReleaseComObject, , , . , , COM-, , .
Marshal.ReleaseComObject Dangerous.