Proper disposal of COM interop objects in C# particularly MS Office applications

前端 未结 3 1961
耶瑟儿~
耶瑟儿~ 2020-12-31 08:42

I am developing an application that relies heavily on multiple Microsoft Office products including Access, Excel, Word, PowerPoint and Outlook among others. While doing rese

3条回答
  •  粉色の甜心
    2020-12-31 09:07

    If you want to release COM objects fully especially in MS Office COM Objects, its very highly recommended that you release sub objects that you must have used which are inside the parent objects.

    In your example, I would say release all Cell, Range any other objects that you may have used before releasing the worksheet that the cell, range or any other object belongs to.

提交回复
热议问题