G
Guadala Harry
I want to have my code loop through a DataTable and set properties of an
object inside the loop - without having to know ahead of time which
properties are being set. The DataTable will contain a varying number of
property/value pairs.
So, how can I set properties of an object at runtime - without hard-coding
the property being set?
For example *rather than* this:
myObject.SomeProperty = "SomeValue";
I want something like this:
string PropToSet = "SomeProperty"; // property to set comes from DataTable
myObject(PropToSet) = "SomeValue"; // value comes from DataTable
How can this be done in C#? What is the correct syntax?
Thanks!
object inside the loop - without having to know ahead of time which
properties are being set. The DataTable will contain a varying number of
property/value pairs.
So, how can I set properties of an object at runtime - without hard-coding
the property being set?
For example *rather than* this:
myObject.SomeProperty = "SomeValue";
I want something like this:
string PropToSet = "SomeProperty"; // property to set comes from DataTable
myObject(PropToSet) = "SomeValue"; // value comes from DataTable
How can this be done in C#? What is the correct syntax?
Thanks!