FAQ: Should I use COMReleaser or Marshal.ReleaseComObject?
Should I use COMReleaser or Marshal.ReleaseComObject?
This article addresses the use of COM objects in .NET code and the appropriate way to dispose of these COM object references.
In .NET code, references to COM objects are held by way of runtime callable wrappers (RCWs). There are two classes used to release the COM object references in .NET code: COMReleaser or Marshall.ReleaseComObject. The COMReleaser class is the recommended method in most situations, because internally it calls the System.Runtime.InteropServices.Marshall.ReleaseCOMObject, which ensures that all COM object references are terminated.
For additional information, please see the help documentation in the Related Information section on how to release COM References.