How can I design a class to receive a delegate having an unknown number of parameters?

前端 未结 6 1132
耶瑟儿~
耶瑟儿~ 2020-12-10 19:55

I continuously find myself having to write timed windows services that poll outside queues or run timed processes. I consequently have a fairly robust template by which to

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 20:25

    One means of having a delegate that takes an unknown set of parameters is to pass an array of objects. You can then use the array's length as the number of parameters, and since any type is convertable into an object, you can pass anything.

提交回复
热议问题