COM Interop is a technology included in the.NET FrameworkCommon Language Runtime (CLR) that enablesComponent Object Model (COM) objects to interact with .NET objects, andvice versa.[1][2][3]
COM Interop aims to provide access to the existing COM components without requiring that the original component be modified. It tries to make the .NET types equivalent to the COM types. In addition, COM Interop allows COM developers to access managed objects as easily as they access other COM objects.
The.NET Framework creates a type library and special registry entries when a component is registered. It provides a specialized utility (RegAsm.exe, usually located inC:\Windows\Microsoft.NET\Framework) that exports the managed types into a type library and registers the managed component as a traditional COM component. When the type is instantiated through COM, the .NETCLR is the actual COM object that executes, and it merely marshals any method calls or property access to the type implementation.
Registration-free COM can be used to avoidDLL hell.
A COM Interop for an existing COM component can be created through the use of theTlbimp.exe tool supplied with the .NET Framework SDK. This tool will create a set of proxy classes implemented inCIL which is encapsulated in anassembly.
COM interop automatically provides the following services to simplify COM usage from .NET:
retval arguments into return values.