c# - How do I call a method on a static class if I've only got the classes string name? -


for example have list of strings happen names of static classes , depending on string name selected want use static class. know method called on static class, , same on each class.

if strings "x", "y", "z" , selected string "z" , method called process(), in code call x.process() in way, x being name of actual static class.

remember these static classes.

you use reflection include namespace class name.

type type = type.gettype("namespace.x"); methodinfo process = type.getmethod("process"); process.invoke(null, null); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -