Common Language Runtime (CLR), Managed Code, and Managed Data

The Common Language Runtime (CLR) is an environment that manages code execution and provides application-development services. Compilers such as VB .NET expose the CLR’s functionality to enable developers to create applications. Code that is created under this environment is called managed code . Note that COM components are not managed code, although they (as well as other unmanaged code) can be used in applications that are built under the CLR.

The output of a compiler includes metadata , which is information that describes the objects that are part of an application, such as:

  • Data types and their dependencies

  • Objects and their members

  • References to required components

  • Information (including versioning information) about components and resources that were used to build the application

Metadata is used by the CLR to do such things as:

  • Manage memory allocations

  • Locate and load class instances

  • Manage object references and perform garbage collection

  • Resolve method invocations

  • Generate native code

  • Make sure that the application has the correct versions of necessary components and resources

  • Enforce security

The metadata in a compiled software component makes the component self-describing. This implies that components, even those written in another language, can interact with the given component directly.

Objects that are managed by the CLR are referred to as managed data. (It is also possible to use unmanaged data in applications.)

Get VB .NET Language 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.