# 4.0 includes a number of enhancements and additions, including:
- Support for dynamic lookup
- Support for both named and optional parameters
- Enhanced COM Interop features
- Support for variance
This article takes a look at the first two items in that list, provides examples, and shows how you can take advantage of them in your applications. A future article covers the last two items.
As you may be able to divine from the terms in the list, some of C#'s new features are tied into Microsoft's new Dynamic Language Runtime (DLR) environment—a new feature of the .NET Framework that enables dynamic languages to reside side-by-side and interoperate with statically typed languages.
|Author's Note: To execute the code examples discussed in this article, you should have Visual Studio 2010 Beta 1 or later installed in your system.|
Understanding the DLR
The DLR adds a set of services that facilitate dynamic language implementations on .NET's managed platform. These services include support for a dynamic type system, a standard hosting model, and fast dynamic code generation. In addition, the DLR lets dynamic and static languages interoperate bi-directionally.
To support the DLR, the .NET Framework 4.0 contains a new System.Dynamic namespace. The Dynamic Language Runtime contains three layers (see Figure 1):
- The .NET Language Integration Layer
- The Dynamic Language Runtime Code Components
- Language Binders
The services the DLR provides include:
- Dynamic Method Dispatch
- Dynamic Code Generation
- Hosting API
With that brief introduction to the DLR, you can move on to explore C#'s new features.