CHAPTER 37

image

Interop

One of the important capabilities of C# is being able to interoperate with existing code, whether it is COM-based or in a native DLL. This chapter provides a brief overview of how interop works.

For more information on interop, check out COM and .NET Interoperability by Andrew Troelsen (Apress, 2002).

COM Objects

Interop with COM objects is a very complex subject; COM and .NET have different—and sometimes incompatible—object models and execution environments.

If you want to use an existing COM object and you can stay within the simple COM interfaces, it is generally fairly straightforward to perform most functions. To call ...

Get A Programmer's Guide to C# 5.0, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.