It is difficult or impossible to immediately throw out all existing code and start over when
a new technology arrives. That’s the situation with Microsoft .NET. It represents a new and
improved way of developing software for the Windows platform. And, given the chance, you
would likely love to rewrite all of your existing code in the newer managed code environment
that .NET provides.
However, you have that little problem known as legacy code. You may have C libraries,
C++ class libraries, Visual Basic 6.0 COM components, or ATL COM components that you rely
upon to run your applications. You may be using third-party libraries and COM components
that represent a significant investment. You can’t simply throw all of that away. Instead, you
need to find a way to move forward with new .NET development while reusing existing pieces
of tested, working code. You need a way to interoperate with the existing code until you have
a chance to finally rewrite all of it in .NET (if ever).
Fortunately, Microsoft .NET provides a rich set of tools that allow you to do just that. These
tools simplify the transition to an all-.NET environment, allowing you to replace a component
here and a component there. The problem is that sometimes those tools are difficult to understand
and use. And in many cases, Microsoft has provided more than one way to accomplish
a particular interop task. Finding the appropriate tool for the task at hand can sometimes be
a frustrating experience.