 | C++ |
 | pBook = NULL |
 | The object is destroyed immediately. |
 | C# |
 | System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook) |
 | oBook = null |
 | By assigning the object to null the object is released (the reference count is decremented) but not destroyed. The garbage collector decides when the object is actually destroyed. Adding the ReleaseComObject-statement speeds up the actual destruction of the object. |
 | VBS |
 | Set oBook = Nothing |
 | The object is destroyed immediately. |
 | VBN |
 | System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook) |
 | oBook = Nothing |
 | By assigning the object to Nothing the object is released (the reference count is decremented) but not destroyed. The garbage collector decides when the object is actually destroyed. Adding the ReleaseComObject-statement speeds up the actual destruction of the object. |