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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -