The C# Dynamic Properties' implementation and a full Expando
It's implemented by the DynamicObject from .NET Framework.
Just an straightforward example in the MSDN - DynamicObject Class.
Wow! But also we have the ExpandoObject.
Some tip from MSDN
The ExpandoObject class is an implementation of the dynamic object concept that enables getting, setting, and invoking members. If you want to define types that have their own dynamic dispatch semantics, use the DynamicObject class. If you want to define how dynamic objects participate in the interoperability protocol and manage DLR fast dynamic dispatch caching, create your own implementation of the IDynamicMetaObjectProvider interface.
Main features:
.
Just an straightforward example in the MSDN - DynamicObject Class.
Wow! But also we have the ExpandoObject.
Some tip from MSDN
The ExpandoObject class is an implementation of the dynamic object concept that enables getting, setting, and invoking members. If you want to define types that have their own dynamic dispatch semantics, use the DynamicObject class. If you want to define how dynamic objects participate in the interoperability protocol and manage DLR fast dynamic dispatch caching, create your own implementation of the IDynamicMetaObjectProvider interface.
dynamic sampleObject = new ExpandoObject();
sampleObject.test = "Dynamic Property";
// Create a new event and initialize it with null.
sampleObject.sampleEvent = null;
// Add an event handler.
sampleObject.sampleEvent += new EventHandler(SampleHandler);
Main features:
- Dynamic properties and methods
- Enumerating and Deleting Members
- !!!
Receiving Notifications of Property Changes with the INotifyPropertyChanged.
I.e. it supports the Data Binding with Change Notifications out of the box.
.
Comments
Post a Comment