Summary

In this chapter, you learned about some of the advanced aspects of COM Interop from the perspective of a .NET client talking to a COM object. You learned about the object life cycle implications of COM Interop, that is, that a COM object when used through COM Interop will behave like a managed object because the RCW will hold a reference to the object until the RCW is garbage collected. If you want to destroy your COM object immediately after its use, you will need to call the ReleaseComObject method on the System.Runtime.InteropServices.Marshal class.

You next learned how COM events map to managed events. You learned that, even though this mapping is difficult to understand, it is trivial to use. I next turned my attention to how COM-rich ...

Get .NET and COM Interoperability Handbook, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.