Although the .NET Framework is extensive , it is not all encompassing. Many projects need to use a mixture of old (COM or Windows) components and new (.NET) components . Even if all the necessary facilities are available within the .NET Framework, it might not be feasible to migrate an entire existing application to .NET all at once.
The .NET Framework and Visual Studio .NET include a variety of features designed to make it easy to use legacy components. In this chapter, you learned about two of those features:
The ability to instantiate and invoke objects from a COM component
The ability to call functions from a Windows API or another DLL
COM components also depend on wrappers called RCWs to work with the .NET Framework. An RCW is a proxy that sends data back and forth between the COM component and .NET components. You can create RCWs with the Type Library Importer command-line tool or by adding the COM component to the references collection of a .NET project.
You might need to call functions from the Windows API or other DLLs. The .NET platform invoke functionality lets you do this. By using the DllImport attribute, you can tell the .NET Framework where to find the implementation of a method call.