To that end, the .NET and C# design teams have made it easy for programmers to interoperate with existing code through the use of unmanaged code.
Unmanaged code refers to code that is not managed, or controlled, by the .NET runtime. In this chapter, I'll cover the three main examples of unmanaged code in .NET, as follows: -
- Platform Invocation Services These services enable .NET code to access functions, structures, and even callbacks in existing, unmanaged dynamic-link libraries (DLLs).
- Unsafe code Writing unsafe code allows the C# programmer to use constructs (such as pointers) in C# applications at the expense of that code being managed by the .NET runtime.
- COM interoperability This term refers to the ability of .NET code to use COM components and of COM applications to use .NET components.