COM interop - disposing COM objects

  • Thread starter Thread starter C# beginner
  • Start date Start date
C

C# beginner

Hi folks,
When we instantiate COM objects from our .NET code and use
them, when we no longer need the COM objects do we have to
dispose of them explicitly? If so, how?
or do the COM objects also go out of scope and get picked
up by the garbage collector? Thanks a lot for your replies.
 
When we instantiate COM objects from our .NET code and use
them, when we no longer need the COM objects do we have to
dispose of them explicitly? If so, how?

The garbage collector will handle the cleanup eventually, yes. You can
use Marshal.ReleaseComObject if you don't want to wait for the GC.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Using COM objects in .NET 2
COM interop between C++ and C# 5
keeping RCW afloat 8
Dispose of COM 3
Disposing Com+ Object 10
How does managed code work? 5
COM - NET integration 2
COM object that returns a string 2

Back
Top