c# - Using Variable as a class name reference -
i have interesting question today. have table stores void name , class file came from.
is possible read table , assign var object based off data in variable?
if , save ton of coding.
public void callmyfunction() { try { var checkerlist = conn.queryasync<functionlist>("select * functionlist",null ); using (ienumerator<functionlist> enumer = checkerlist.result.getenumerator()) { while (enumer.movenext()) { functionlist current = enumer.current; string myfunctiontocall = current.functionname ; string myobjecttocall = current.functionobject; methodinfo dynmethod = this.gettype().getmethod(myfunctiontocall, bindingflags.nonpublic | bindingflags.instance); dynmethod.invoke(myobservertocall, new object[] { myfunctiontocall }); } } } catch { } }
Comments
Post a Comment