WHAT’S IN THIS CHAPTER?
- Understanding the Dynamic Language Runtime
- The dynamic type
- The DLR ScriptRuntime
- Creating dynamic objects with DynamicObject and ExpandoObject
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
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.
ExpandoObject, which is the frameworks implementation of
DynamicObject, will also be covered.
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 common language runtime (CLR) to enable the addition of dynamic languages such as Ruby and Python. It also enables C# to take on some of the same dynamic capabilities ...