c# - Get dynamic property from Settings -
i've got few properties stored in appconfig , want access them dynamically (e.g. in loop or function).
accessing values using mysettings.name_of_that_thing no problem, if name variable?
i tried:
string propertyvalue = mysettings.gettype().getproperty("name_of_that_thing").tostring();
but thing got name of property. how can this?
string propertyvalue = mysettings.gettype() .getproperty("name_of_that_thing") .getvalue(mysettings, null); //replace mysettings null in getvalue(...) if mysettings static class
Comments
Post a Comment