Is it possible in runtime to create a class from DataTable where ColumnName will be dynamic-class properties?
With C# 4, you can do this
dynamic foo = new ExpandoObject();
// mimic grabbing a column name at runtime and adding it as a property
((IDictionary<string, object>)foo).Add("Name", "Apple");
Console.WriteLine(foo.Name); // writes Apple to screen
Not recommending it or anything, but it shows you it is possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With