A Primer to DynamicMetaObject

As you saw earlier, the use of DynamicObject allows an object to participate in the binding process for a wide variety of operations. This is actually aligned with a general design philosophy in the DLR where objects get the first crack at defining meaning for binding operations, before language-specific binders get around to assist.

One of the core benefits of such dynamic objects is they follow a protocol that allows them to be used across different languages. Our self-written Bag object can therefore be used from languages other than C# (for example, from IronPython, as shown in Figure 22.20).

Image

FIGURE 22.20 Using ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.