By using 'Expando' objects we can enable your custom classes to be consumed in dynamic languages. So you can create an object of 'Expando' class and pass to dynamic languages like ruby, javascript, python etc. 'Expando' objects helps to add properties on fly.
using System.Dynamic;
We then create the object of 'ExpandoObject' and assign it to an object which created from 'Dynamic' class type. Please note if we have used 'Dynamic' objects and not expand objects as we still do not know what properties are going to be created during runtime.
dynamic obj = new ExpandoObject();
For creating dynamic property we just need to write the property name and set the value.
obj.Name = "Some Name";
Finally we display the value.
MessageBox.Show(obj.Name);
Senthil D
Kundan64, if this helps please login to Mark As Answer. | Alert Moderator