O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Custom Dynamic Objects with DynamicObject

So far, we haven’t had a chance to control any of the binding logic that happens at runtime when invoking dynamic operations on an object. The flexible infrastructure of the DLR provides a way to create objects that participate in those operations. To achieve this, the simplest route is the use of System.Dynamic.DynamicObject, which is defined as shown in Figure 22.17.

Image

FIGURE 22.17 A look at DynamicObject and IDynamicMetaObjectProvider.

As you can see, this base class contains Try methods for every dynamic operation that’s supported by the DLR. The Binder objects passed as the first argument correspond ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required