Chapter 12. Dynamic Language Extensions
WHAT'S IN THIS CHAPTER?
Understanding the Dynamic Language Runtime
The DLR ScriptRuntime
var keyword and anonymous methods started C# down the "dynamic" road. In version 4, the
dynamic type was added. Although C# is still a statically typed language, these additions give it the dynamic capabilities that some developers are looking for.
In this chapter, you'll look at the
dynamic type and the rules for using it. You'll also see what an implementation of
DynamicObject looks like and how it can be used.
DYNAMIC LANGUAGE RUNTIME
The dynamic capabilities of C# 4 are part of the Dynamic Language Runtime (DLR). The DLR is a set of services that is added to the CLR to allow the addition of dynamic languages such as Ruby and Python. It also allows C# to take on some of the same dynamic capabilities that these dynamic languages have.
There is a version of the DLR that is open source and resides on the CodePlex web site. This same version is included with the .NET 4 Framework, with some additional support for language implementers.
In the .NET Framework, the DLR is found in the
System.Dynamic namespace as well as a few additional classes in the
IronRuby and IronPython, which are open source versions ...