Introduction

.NET provides a number of features, such as garbage collection and managed memory, that make programming easier and safer than before. However, there are millions of lines of existing code that are here to stay for a considerable time. One of the goals of the .NET Framework designers was to provide smooth interoperability between managed and unmanaged code.

Let's refresh our understanding of managed and unmanaged code. Managed code is the code that is written according to the specifications of the common language runtime (e.g., providing metadata). Managed code can take advantage of the services provided by the common language runtime such as garbage collection and enhanced security. Unmanaged code on the other hand is any code that ...

Get .NET Programming: A Practical Guide Using C# 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.