Creating a dynamic instance:
dynamic Student = new ExpandoObject(); Student.ID = 1; Student.Name = "John";Student.Grade = 10;
Creating a nested dynamic instance:
Student.Addess = new ExpandoObject(); Student.Addess.City = "London"; Student.Addess.Country = "UK"; Student.Addess.StreetNo = 123456;Dynamically binding an Event
Student.Click += new EventHandler(SampleHandler); private void SampleHandler(object sender, EventArgs e) { //throw new NotImplementedException(); }Pass parameter as dynamic.
public void Write(dynamic Student) { //do stuff }