I need to create dynamic object and its properties at run-time then create instance of this object to store values.
why I want above logic!
I am reading excel file in C# and first line of code is header which is actually properties and followed by each rows are record which is instance of dynamic object.
List<string> ExcelDataHeader = new List<string>();
for (int y = 2; y <= colCount; y++)
{
ExcelDataHeader.Add(xlRange.Cells[headerRow, y].Value2.ToString());
}
dynamic MyDynamic = new System.Dynamic.ExpandoObject();
??????????
I need to return excel read data in object