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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -