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).
Get C# 5.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.