草庐IT

PassMeAMethod

全部标签

c# - 将方法作为参数传递

这个问题在这里已经有了答案:PassMethodasParameterusingC#(13个答案)关闭2年前。我希望能够将方法作为参数传递。例如..//reallydodgycodepublicvoidPassMeAMethod(stringtext,Methodmethod){DoSomething(text);//callthemethod//method1();Foo();}publicvoidmethodA(){//Dostuff}publicvoidmethodB(){//Dostuff}publicvoidTest(){PassMeAMethod("callingmetho