April 2008
Intermediate to advanced
704 pages
17h 49m
English
Problem
You need to ensure that a COM component is removed from memory immediately, without waiting for garbage collection to take place, or you need to make sure that COM objects are released in a specific order.
Solution
Release the reference to the underlying COM object using the Shared Marshal.FinalReleaseComObject method and passing the appropriate RCW reference.
How It Works
COM uses reference counting to determine when objects should be released. When you use an RCW, the reference will be held to the underlying COM object, even when the object variable goes out of scope. The reference will be released only when the garbage collector disposes of the RCW object. As a result, you cannot control when ...
Read now
Unlock full access