Metadata C# Help

With COM, all information about the component is stored inside the type library. The type library includes information such as names and IDs of interfaces, methods, and arguments. With .NET, all this information can be found inside the assembly itself, as you saw in Chapter 13, “Reflection,” and Chapter 17, “Assemblies.” The problem with COM is that the type library is not extensible. With C++, IDL (interface definition language) files have been used to describe the interfaces and methods. Some of the IDL modifiers cannot be found inside the type library, because Visual Basic (and the VisualBasic team was responsible for the type library) couldn’t use these IDL modifiers. With .NET, this problem doesn’t exist because the .NET metadata is extensible using custom attributes.

As a result of this behavior, some COM components have a type library and others don’t. Where no type library is available, a C++ header file can be used that describes the interfaces and methods. With .NET, it is easier using COM components that do have a type library, but it is also possible to use COM components without a type library. In that case, it is necessary to redefine the COM interface by using C# code.

Posted on October 27, 2015 in Interoperability

Share the Story

Back to Top
Share This