c# - Switch with methods without constants -


i want accomplish task there method in c#. give me syntax please.

switch(methods) {    case method1:    //do method2    case method3:    // method4    case method5:    // method6 } 

you can if know class name , method name actually. see below

type magictype = type.gettype("magicclass"); methodinfo magicmethod = magictype.getmethod("itsmagic");         object magicvalue = magicmethod.invoke(); 

check below url
https://msdn.microsoft.com/en-us/library/a89hcwhh(v=vs.110).aspx


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -