Inspecting an Assembly for COM Types
This section describes ways to inspect COM type information (as metadata) to determine the signature of the methods you want to call from your .NET client.
Metadata for a coclass is placed in a namespace with the same name as that of the type library from which the metadata was created. For example, if you convert a type library named LoanLib to an assembly file named LOANLib.dll and that type library contains a class named Loan, the namespace created would be named LOANLib, and the fully resolved name of the class would be LOANLib.Loan.
You can alter the namespace by using the /namespace: option of the Tlbimp tool.
The System.Type class provides methods to inspect metadata. If the COM type has accompanying metadata (produced with the Tlbimp.exe (Type Library Importer) tool or equivalent API), complete information is available about the type through the instance of the Type class. If the COM type does not have accompanying metadata, the Type provides relatively little information.
The Windows Software Development Kit (SDK) provides the Microsoft intermediate language (MSIL) Disassembler (Ildasm.exe), which is a graphical tool to display metadata in a hierarchical tree view. This tool provides readable descriptions of the metadata and is similar to OleView (a tool often used in COM development efforts).
Ildasm.exe displays metadata for any managed portable executable (PE) file, including type libraries imported as assembly files. For example, if you import a type library named LoanLib to an assembly file named LOANLib.dll, you can view the managed types in the assembly using the following command:
The LOANLib.dll comprises type definitions for the Loan class and the ILoan interface. Ildasm.exe displays member descriptions for the Loan class and ILoan interface.