Release COM Objects

Suppose if we are using Microsoft.Office.Interop.Outlook library so in that case we cannot call Dispose method to release memory for that we need to call a method of Marshal to release the COM objects and also we can check COM objects for null or not.

1:  Marshal.ReleaseComObject(MailItem Object)
     Marshal.ReleaseComObject(COM Object)

2: If !(COM Object)=null
{
Marshal.ReleaseComObject(COM Object)
}


Thanks.
Ebook Download
View all
Learn
View all