CHAPTER 16 DYNAMIC TYPES AND THE DYNAMIC LANGUAGE RUNTIME
Source Code The LateBindingWithDynamic project is included under the Chapter 16 subdirectory.
Simplifying COM Interoperability Using Dynamic Data
Let’s see another useful case for the dynamic keyword within the context of a COM interoperability
project. Now, if you don’t have much background in COM development, do be aware for this next
example that a compiled COM library contains metadata, just like a .NET library; however, the format is
completely different. Because of this, if a .NET program needs to communicate with a COM object, the
first order of business is to generate what is known as an interop assembly (described in the following
paragraphs). Doing so is quite straightforward. Just activate the Add Reference dialog box, select the
COM tab and find the COM library you want to make use of (see Figure 16-5).
Figure 16-5. The COM tab of the Add Reference dialog box will show you all registered COM libraries on
your machine
Note Be aware that several important Microsoft object models (including Office products) are currently
accessible only through COM interoperability. Thus, even if you do not have direct experience building COM
applications, you might need to consume them from a .NET program.
612