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).
Figure 22.20. Using our
Bag dynamic object in IronPython.
This common protocol for interoperability with dynamic objects ...