Understanding COM and .NET Interoperability

Microsoft .Net Framework is used to develop web applications and windows applications by applying objects and components. When the application is small you do not find the need to borrow the readymade components from other applications, but if the application is very complex you would want to consume those components to save time. Apart from saving time, COM and .NET interoperability also allows you to continue with the existing code as well as use other components, thereby saving the existing investment.

Moreover, you do not need to make use of the other components entirely. .Net has the capability to use even a small part of other components with your existing code. The flexibility or the interoperability between COM and .Net allows you to either use COM component from .Net or use .Net components from COM. To use COM components from .Net there is a tool that takes a COM component or type library and creates a managed assembly also called Runtime Callable Wrapper (RCW). This wrapper assembly is the DLL file created by tlbimp.exe or the VS.NET IDE. Similarly to use .Net components from COM you can use the wrapper class that organizes the COM calls through to the managed code. In addition, you should create interfaces for .Net components to be available in COM. These interfaces can be created either manually or automatically.

You can make use of existing COM components by using late-bound and early-bound references. Both late-bound and early-bound references are objects that are created and set to object types. The difference between them is that late-bound reference is set to object type at runtime and early-bound reference is set to object type at design time. Moreover, the late-bound COM reference is used by writing Server.CreateObject() method and the early-bound COM reference uses a built-in utility that creates a proxy class.



“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.