Pass Method as Parameter using C#

后端 未结 12 1544
不知归路
不知归路 2020-11-21 23:30

I have several methods all with the same parameter types and return values but different names and blocks. I want to pass the name of the method to run to another method tha

12条回答
  •  暖寄归人
    2020-11-22 00:27

    Here is an example without a parameter: http://en.csharp-online.net/CSharp_FAQ:_How_call_a_method_using_a_name_string

    with params: http://www.daniweb.com/forums/thread98148.html#

    you basically pass in an array of objects along with name of method. you then use both with the Invoke method.

    params Object[] parameters

提交回复
热议问题