Let's say that I have a a list of elements of 'n' size. I want to add 'n' properties in a dynamic object .How can I achieve this? We can't just hard code it because length of list is dynamic.
So an object is required in which I need to add properties on the basis of length of list.
object should contain all element of list as seperate field .We can't store it in a data structure
dynamicobj = new ExpandoObject();
foreach(Employee emp in EMPLIST){
temp=emp.FirstName; //emp is object of Employee class and Emplist contains object of employee class
obj.temp=emp;
}