The Common Language Runtime
One of the major components of the .NET Framework is the Common Language Runtime, or CLR. The CLR provides a number of benefits to the developer, such as exception handling, security, debugging, and versioning, and these benefits are available to any language built for the CLR. This means that the CLR can host a variety of languages and can offer a common set of tools across those languages. Microsoft has made VB, C++, and C# "premier" languages for the CLR, which means that these three languages fully support the CLR. In addition, other vendors have signed up to provide implementations of other languages, such as Perl, Python, and even COBOL.
When a compiler compiles for the CLR, this code is said to be managed code. Managed code is simply code that takes advantage of the services offered by the CLR. For the runtime to work with managed code, that code must contain metadata. That metadata is created during the compilation process by compilers targeting the CLR. The metadata is stored with the compiled code and contains information about the types, members, and references in the code. Among other things, the CLR uses this metadata to:
Generate native code
The runtime also handles object lifetimes. Just as COM/COM+ provided reference counting for objects, the CLR manages references to objects and removes them from memory when all the references are gone, through the process known as garbage collection. Objects managed by the runtime are called managed data. You can interact with both managed and unmanaged data in the same application, although managed data gives you all the benefits of the runtime.
The CLR defines a standard type system to be used by all CLR languages. This means that all CLR languages will have the same size integers and longs, and they will all have the same type of stringno more worrying about BSTRS and CSTRS! This standard type system opens up the door for some powerful functionality. For example, you can pass a reference of a class from one component to another, even if those components are written in separate languages. You also can derive a class in C# from a base class written in VB.NET, or any other combination of languages targeted to the runtime.
Managed code includes metadata, which contains information about the components used to create the code. The runtime can check to make sure that resources on which you depend are available. The metadata removes the need to store component information in the registry. That means that moving a component to a new machine does not necessarily require registration, and removing components is as simple as deleting them.
As you can see, the Common Language Runtime provides a number of benefits that are not only new but that also should enhance the experience of building applications. Other benefits that you will see in more detail include some of the new object-oriented features to VB.NET. Many of these new features are not so much additions to the language as they are features of the runtime that are simply being exposed to the VB.NET.