Chapter 37. System.Runtime.InteropServices

The types in this namespace work with unmanaged code using either PInvoke or COM. PInvoke (short for Platform Invoke) lets you access functions that reside in underlying operating system-specific shared libraries (on Win32, these are DLLs). COM (Component Object Model) is a Win32 legacy component architecture that is used throughout Windows and Windows applications. Many programmers experience COM through the object models of applications such as Microsoft Office, Exchange, and SQL Server. The COM support in .NET lets you access COM components as though they were native .NET classes. For an overview of PInvoke, see Chapter 17 and Chapter 18. Many of the types in this namespace are custom attributes. For information on how the flags and properties of a custom attribute map to its actual usage, see Chapter 14.

We have omitted some of the more esoteric parts of this namespace, so there are some classes that aren't discussed here. For the most part, you will not need those classes unless you are developing specialized code that handles marshaling data types between managed and unmanaged code. If so, you should consult the MSDN .NET reference materials. Figures Figure 37-1 and Figure 37-2 show the types in this namespace.

    Part II: Programming with the .NET Framework
    Part IV: API Quick Reference
    Chapter 26. System