Interoperating with Unmanaged Code

The .NET runtime supports bi-directional interop with unmanaged code via COM, COM+, and native Win32 API calls. The FCL provides a set of classes and attributes that support this, including precise control of managed object lifetime, and the option of creating user-defined custom marshallers to handle specific interop situations (see Chapter 17 and Chapter 18).

For more information, see the following namespaces:

System.Runtime.InteropServices
System.Runtime.InteropServices.CustomMarshalers
System.Runtime.InteropServices.Expando

An important related type in another namespace is System.Buffer.

Get C# in a Nutshell 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.