I have inherited a code base, and I am writing a small tool to update a database. The code uses a data access layer such as SubSonic (but it is homegrown). There are many object properties, such as id, templateFROM, and templateTO, but there are 50 of them.
On the screen, I canβt display all 50 properties in my own text field for entering data, so I have a list of all possible properties and one text field for editing. When they select a property from the list, I populate the text box with the value that the property corresponds to. Then I need to update the property after editing is complete.
I am currently using two huge case statements. It seems silly to me. Is there a way to dynamically tell C # which property I want to set or get? Maybe like:
entObj."templateFROM" = _sVal;
??
source share